Skip to content

Instantly share code, notes, and snippets.

View zirosas's full-sized avatar

Jiro Sasamoto zirosas

View GitHub Profile
function mysql_real_escape_string (str) {
return str.replace(/[\0\x08\x09\x1a\n\r"'\\\%]/g, function (char) {
switch (char) {
case "\0":
return "\\0";
case "\x08":
return "\\b";
case "\x09":
return "\\t";
case "\x1a":
@zirosas
zirosas / Decrypt the WordPress password
Created June 26, 2013 19:53
Decrypt the WordPress password. include('classhash.php')
$username = '';
$password = '';
$strSql = "SELECT user_pass FROM wp_users WHERE user_login = '$username'";
$result = mysql_query($strSql);
$row = mysql_fetch_array($result);
$encpass = $row['user_pass'];
if(!is_null($encpass)) {
include('classhash.php');
@zirosas
zirosas / Set DiffMerge as default merge tool in OS X
Last active January 13, 2016 16:21
Set DiffMerge as default merge tool in OS X From https://coderwall.com/p/3wuuda
git config --global merge.tool diffmerge
git config --global mergetool.diffmerge.cmd "diffmerge --merge --result=\$MERGED \$LOCAL \$BASE \$REMOTE"
git config --global mergetool.diffmerge.trustExitCode true
ln -s /Applications/DiffMerge.app/Contents/Resources/diffmerge.sh /usr/local/bin/diffmerge
git config --global mergetool.keepBackup false
@zirosas
zirosas / Ignoring versioned files
Last active January 3, 2016 12:39
Git lets you ignore those files by assuming they are unchanged.
This is done by running the git update-index --assume-unchanged path/to/file.txt command. Once marking a file as such, git will completely ignore any changes on that file; they will not show up when running git status or git diff, nor will they ever be committed.
To make git track the file again, simply run
git update-index --no-assume-unchanged path/to/file.txt.
https://help.github.com/articles/ignoring-files
@zirosas
zirosas / gist:8444740
Created January 15, 2014 21:09
Rails + MySQL on OSX : Library not loaded: libmysqlclient.18.dylib
sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib
@zirosas
zirosas / OS X mySQL
Last active January 2, 2016 13:39
On OS X to start/stop/restart MySQL from the command line:
sudo /usr/local/mysql/support-files/mysql.server start
sudo /usr/local/mysql/support-files/mysql.server stop
sudo /usr/local/mysql/support-files/mysql.server restart
@zirosas
zirosas / locate svn binary
Created December 8, 2013 23:25
OS X Mavericks にsvnXをインストール
Unable to locate svn binary
×:/usr/local/bin
○/Applications/Xcode.app/Contents/Developer/usr/bin/
@zirosas
zirosas / gist:7760085
Created December 2, 2013 22:16
GIT: ignoring changes in tracked files
git update-index --assume-unchanged <file>
git update-index --no-assume-unchanged <file>
@zirosas
zirosas / pbcopy
Created November 17, 2013 00:42
pbcopy
pbcopy < ~/.ssh/id_rsa.pub
Problem: TinyMCE rich-text editor disables the operating system spellchecker when using Firefox or Chrome.
Solution: Set the TinyMCE configuration “gecko_spellcheck” to TRUE.
tinyMCE.init({
...
gecko_spellcheck : true
});