LAMP How To – Open Source At Work

Only Passion Matters

Entries for the ‘Blog’ Category

using set_transient in wordpress

set_transient is an excellent caching mechanism in wordpress. However one thing to note is that it depends on the caching plugin that is installed. So for example, if the plugin caching mechanism is memcache, the cache will be stored in memcache instead of in the db. Hence clearing the memcache from the plugin will clear [...]

wordpress caching and mobile theme plugins

when using caching plugin such as w3tc in wordpress, it will try to cache the mobile version as well and there could be a possibility that mobile users might see the desktop version and vice versa. So the idea is to disable the caching plugin for mobile agents:
if using w3tc, under page cache -> rejected [...]

git: finding file changed since certain date and upload a server

good old bash.

git log -p –since={2011-11-01} | grep “diff –git” | awk ‘{print $3}’ | sed ’s/^a\///g’ | sort -rn | uniq | while read s; do scp $s root@yourip:/server_path/$s; done;

playing with cat and awk

cat can print out line number and awk lets you format it. This combo is excellent to manipulate files
creating a csv for eg.

cat -n phpbook.csv | awk ‘{print $2″,”$1}’ > phpbook1.csv

Git Submodule By Example

If you have been working with version control system for a while, you would know or speculated about the possibility of including references from other projects into your project. From a programmer’s point of view, this feature is useful especially when you need to include code libraries owned by someone else or common header/footer [...]