Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am mitzip on github.
  • I am mitzip (https://keybase.io/mitzip) on keybase.
  • I have a public key whose fingerprint is 199E 3E07 5FC4 668C 5E7A F11E 5CC2 441B 8563 0E3D

To claim this, I am signing this object:

findfun() {
if [ -z "$1" ]; then
echo "USAGE: findfun dev-db/mongodb"
echo "USAGE: findfun dev-db/mongodb-2.4.9.ebuild"
return 1
fi
echo "\n=== Gentoo CVS ===" # Probably need cvs 1.12+
cvs -d :pserver:anonymous@anoncvs.gentoo.org:/var/cvsroot rls gentoo-x86/$1
@nerdy-sam
nerdy-sam / dateFormat.js
Created February 5, 2012 04:59
PHP's Date function ported to javascript
// PHP's Date function ported to javascript
// MIT Open-source licensed
// http://jacwright.com/projects/javascript/date_format/
Date.prototype.format=function(format){var returnStr='';var replace=Date.replaceChars;for(var i=0;i<format.length;i++){var curChar=format.charAt(i);if(i-1>=0&&format.charAt(i-1)=="\\"){returnStr+=curChar}else if(replace[curChar]){returnStr+=replace[curChar].call(this)}else if(curChar!="\\"){returnStr+=curChar}}return returnStr};Date.replaceChars={shortMonths:['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],longMonths:['January','February','March','April','May','June','July','August','September','October','November','December'],shortDays:['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],longDays:['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],d:function(){return(this.getDate()<10?'0':'')+this.getDate()},D:function(){return Date.replaceChars.shortDays[this.getDay()]},j:function(){return this.getDate()},l:function(){return Date.replaceChars.
@nerdy-sam
nerdy-sam / arraySwap.js
Created February 5, 2012 04:58
Swap keys for values in javascript array
// Swaps array values with keys.
// keep this comment to reuse freely: http://www.fullposter.com/?1
// If 2nd argument passed, values become keys,
// but keys do NOT become values: ALL values become second argument
function arraySwap(array,overwriteNewValue,keepKey){if(typeof(array)=="undefined"){return false;};if(typeof(array)!="object"){array=new Array(array);};var output=new Array();if(typeof(overwriteNewValue)=="undefined"){for(var k in array){output[array[k]]=k;}}else{if(!keepKey){for(var k in array){output[array[k]]=overwriteNewValue;}}else{for(var k in array){output[k]=overwriteNewValue;}};}return output;}
@nerdy-sam
nerdy-sam / gist:1656231
Created January 22, 2012 08:13
Simple Logging Class for PHP
/**
* Simple Logging Class for PHP
*
* I hate using “echo” statements in PHP for debugging. Instead,
* I prefer to tail a log file. I wrote this little logging class
* that I can include in whatever project I’m working on.
*
* @author Joyce Johnston http://fourmilestomay.com/contact-us/
* @license Unknown but made public by author
* @link http://fourmilestomay.com/2009/simple-logging-class-for-php/