Skip to content

Instantly share code, notes, and snippets.

@davepoon
davepoon / gist:4371622
Created December 25, 2012 04:29
Added the .gitignore, and refresh the file index so the files get ignored properly.
git rm -r --cached .
git add .
git commit -m ".gitignore is now working"
@davepoon
davepoon / gist:4220464
Created December 5, 2012 23:24
PHP Regex to get src value
<?php
$input_string = '<script type="text/javascript" src="http://localhost/assets/javascript/system.js" charset="UTF-8"></script>';
$count = preg_match('/src=(["\'])(.*?)\1/', $input_string, $match);
if ($count === FALSE)
echo('not found\n');
else
echo($match[2] . "\n");
$input_string = "<script type='text/javascript' src='http://localhost/index.php?uid=93db46d877df1af2a360fa2b04aabb3c' charset='UTF-8'></script>";
$count = preg_match('/src=(["\'])(.*?)\1/', $input_string, $match);
@davepoon
davepoon / gist:3984681
Created October 31, 2012 03:48
A vim command to save a file in vim or vi without root permission
:w !sudo tee %
@davepoon
davepoon / gist:3984488
Created October 31, 2012 02:37
Git submodule update command
git submodule -q foreach git pull -q origin master