/var/log

Show custom post types in category archives

Custom post types are not displayed in the category and tag archives by default, even if you indicated in the register_post_type call that it should support these taxonomies. The way to include them in the category and tag archives is to use the pre_get_posts action: add_action('pre_get_posts', 'mycode_pre_get_posts'); function mycode_pre_get_posts($query) { if ((is_home() || is_category() || […]

Single selected taxonomy in WordPress

The category taxonomy is by default a multiselect widget that uses checkboxes. There are some ways to only allow one selection, like implementing your own Walker_Category_Checklist. But the most simple solution is just replace the checkbox inputs with radio input boxes with some Javascript. In the example below, I have a taxonomy "level" that I want […]

Laravel and SELinux

When SELinux is enabled, apache can be denied to write to the storage directory even if the permission of this directory is set to 777. chcon -Rt httpd_sys_content_rw_t storage/ You can see the result: ls -Z

Firebase Cloud Messaging without google-services.json file

The default way to initialize Firebase in your Android app is to use the google-services.json file you can download from the firebase console. The content of this file will be automatically merged by gradle to initialize the FirebaseApp instance for your app. To manually initialize a FirebaseApp app, you can do the following (I replaced the real […]

SSH Agent forwarding on Bash on Ubuntu on Windows

To enable key forwarding on Bash on Ubuntu on Windows. Create a ~/.ssh/config file with at least: Host *   ForwardAgent yes Start ssh-agent: eval `ssh-agent -s` Then add key(s): ssh-add Then you can ssh into some machine.

Remove animation Android activity

By setting some style properties, you can remove the animation. <style name="ThemeWindowNoAnimation" parent="Theme.AppCompat.NoTitleBar.Fullscreen"> <item name="android:windowAnimationStyle">@null</item> <item name="android:windowEnterAnimation">@null</item> <item name="android:windowExitAnimation">@null</item> </style>

Change Android homeAsUpIndicator icon in Titanium

For a project I wanted to show a hamburger menu icon in the main screen that shows a navigation drawer. The steps I did: I manually enabled the displayHomeAsUp property of the ActionBar and handled the onHomeIconItemSelected event to show the navigation drawer: $.mainWindow.activity.actionBar.displayHomeAsUp = true; $.mainWindow.activity.actionBar.onHomeIconItemSelected = function() { onMenu(); }; And also replaced the "back" […]

Remove shadow Android ActionBar

If you want to remove the shadow below the ActionBar (for example in the AppCompat.Light theme), first create a style: <style name="ThemeActionBarWithoutShadow" parent="@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse"> <item name="elevation">0dp</item> <!--<item name="android:elevation">0dp</item>--> </style> And then reference it from within a theme: <style name="ThemeDefault" parent="Theme.AppCompat.Light"> <item name="colorPrimary">#F2E49F</item> <item name="colorPrimaryDark">#F2E49F</item> <item name="actionBarStyle">@style/ThemeActionBarWithoutShadow</item> </style>

Android emulator screenshot

A simple way to take screenshots of your Android emulator: adb shell /system/bin/screencap -p /sdcard/screenshot.png adb pull /sdcard/screenshot.png screenshot.png

Laravel and SVN

Laravel assumes you're using GIT to handle version control. Here is a guideline to fix it for SVN. In short: just add all the files and directories named  in the .gitignore files to the SVN ignore list. Add the contents of the following directories to the ignore list (so the directories will be in version […]