Skip to content

Instantly share code, notes, and snippets.

@ifnull
ifnull / gist:3093580
Created July 11, 2012 21:13
Aitoc Fix
sudo mkdir store/var/ait_rewrite/
sudo chmod -R 777 store/var/ait_rewrite/
sudo chmod -R 777 store/app/code/local/Aitoc/
sudo chmod -R 777 store/app/etc/modules/Aitoc_*.xml
git update-index --assume-unchanged store/app/etc/modules/Aitoc_Aitpreorder.xml
git update-index --assume-unchanged store/app/etc/modules/Aitoc_Aitsys.xml
sed -e "s/\<active\>true\<\/active\>/\<active\>false\<\/active\l>/g" -i '' store/app/etc/modules/Aitoc_Aitpreorder.xml
sed -e "s/\<active\>true\<\/active\>/\<active\>false\<\/active\l>/g" -i '' store/app/etc/modules/Aitoc_Aitsys.xml
@ifnull
ifnull / gist:3252675
Created August 3, 2012 23:31
FizzBuzz in PHP
<?php
/*
* Requirements: No math functions, get single iteration, get iteration range and get infinite iterations
* $start: Starting iteration
* $count: Number of iterations with "0" being infinite.
*/
$start = 10;
$count = 0;
@ifnull
ifnull / gist:3269922
Created August 6, 2012 03:48
Pipl email regex search
# Where foo is the first letter in the email, bar is the last, foobar is the domain extension, 4 is the number of asterisks in the email and 3 is the length of the domain name.
foo+[A-Z0-9._%+-]{4}+bar+@[A-Z0-9.-]{3}+\.foobar
@ifnull
ifnull / .bash_profile
Created August 20, 2012 18:55
.bash_profile
export PATH=~/bin:/usr/local/bin:/usr/local/mysql/bin:$PATH
export EDITOR='subl -w'
export CLICOLOR=1
export TERM=xterm-color
# ssh-agent
# ensure the agent plist is running as well
# see http://tim.vanwerkhoven.org/post/2011/11/17/OSX-launchd-and-launchctl-issues
# for more info : launchctl list org.openbsd.ssh-agent
@ifnull
ifnull / gist:3406771
Created August 20, 2012 19:05
virtualenv aliases
# virtualenv aliases
# http://blog.doughellmann.com/2010/01/virtualenvwrapper-tips-and-tricks.html
alias v='workon'
alias v.deactivate='deactivate'
alias v.mk='mkvirtualenv --no-site-packages'
alias v.mk_withsitepackages='mkvirtualenv'
alias v.rm='rmvirtualenv'
alias v.switch='workon'
alias v.add2virtualenv='add2virtualenv'
alias v.cdsitepackages='cdsitepackages'
@ifnull
ifnull / memcached-php.rb
Created August 28, 2012 03:26
brew install memcached
require 'formula'
class MemcachedPhp < Formula
url 'http://pecl.php.net/get/memcached-2.1.0.tgz'
homepage 'http://pecl.php.net/package/memcached'
sha1 '16fac6bfae8ec7e2367fda588b74df88c6f11a8e'
depends_on 'libmemcached'
@ifnull
ifnull / memcache-php.rb
Created August 28, 2012 05:04
brew install memcache
require 'formula'
class MemcachePhp < Formula
url 'http://pecl.php.net/get/memcache-3.0.6.tgz'
homepage 'http://pecl.php.net/package/memcache'
sha1 'eb0c922df3f5ca459bcce85e141f379d3b490ca7'
def install
Dir.chdir "memcache-#{version}" do
# See https://github.com/mxcl/homebrew/pull/5947
@ifnull
ifnull / gist:3495360
Created August 28, 2012 06:02
Install PEAR on Lion
sudo php /usr/lib/php/install-pear-nozlib.phar
pear config-set php_ini /private/etc/php.ini
pecl config-set php_ini /private/etc/php.ini
sudo pear upgrade-all
@ifnull
ifnull / gist:3500363
Created August 28, 2012 16:46
Memcache on native Lion install of PHP

If you are running the native install of PHP the is shipped with Lion, use the following to install Memcache.

brew install libmemcached
mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/memcached/1.4.13/homebrew.mxcl.memcached.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.memcached.plist
sudo pecl install memcache
@ifnull
ifnull / gist:3961743
Created October 26, 2012 21:44
CURL IP w/ specific host
# Bypass HOSTS file and DNS and send request directly to IP with specified host name.
# Example below sends request to localhost with the host name www.foobar.com.
curl -sL -w "%{http_code}\\n" -o /dev/null --insecure --resolve 'www.foobar.com:127.0.0.1' https://www.foobar.com/