This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Assuming 5 fixed digits | |
function dehydrateFloat(f){ | |
return Math.floor(f.toFixed(5)*100000).toString(36); | |
} | |
function hydrateFloat(dryf){ | |
return (parseInt(dryf,36)/100000).toFixed(5); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find . -type f -name "*.jpg" -o -name "*.png" -o -name "*.gif" | xargs file | grep ASCII | awk -F":" '{print $1}' | xargs rm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function foobarbaz(){ | |
// Extract environment object to local scope (not mandatory, you can access the parent scope via $this. Ex. $this->foo ) | |
extract((array)$this); | |
var_dump($foo, $bar, $baz); | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Retrieve the body of an user-defined function | |
*/ | |
function get_function_code($funcname){ | |
try { | |
$ref = new ReflectionFunction($funcname); | |
if ($ref->isInternal()){ | |
return '/*INTERNAL*/'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Token { | |
protected static $secret = 'dont_tell_anyone'; | |
public static function secret($the_secret=null){ | |
return $the_secret ? static::$secret = $the_secret : static::$secret; | |
} | |
protected static function decompose($token){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/ HTML5 Doctype. Remember to delete these comments (Quirks Mode). | |
!!! | |
/ Modernizr HTML tag. | |
%html.no-js{lang: ""} | |
/ Let's get started. | |
%head | |
/ Document settings and metadata. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<!-- Run in full-screen mode. --> | |
<meta name="apple-mobile-web-app-capable" content="yes"> | |
<!-- Make the status bar black with white text. --> | |
<meta name="apple-mobile-web-app-status-bar-style" content="black"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--[if !IE]> | |
<script src="//html5shiv-printshiv.googlecode.com/svn/trunk/html5shiv-printshiv.js"></script> | |
<![endif]--> | |
<!--[if IE 11]> | |
<script src="//html5shiv-printshiv.googlecode.com/svn/trunk/html5shiv-printshiv.js"></script> | |
<![endif]--> | |
<!--[if IE 10]> | |
<script src="//html5shiv-printshiv.googlecode.com/svn/trunk/html5shiv-printshiv.js"></script> | |
<![endif]--> | |
<!--[if IE 9]> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// function for extending a class | |
function extend (base, constructor) { | |
var prototype = new Function(); | |
prototype.prototype = base.prototype; | |
constructor.prototype = new prototype(); | |
constructor.prototype.constructor = constructor; | |
} | |
// parent class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function g($x=0,$r=0){ | |
static $b; | |
$r || $b='g'; | |
$x || $b.='o'; | |
return $x?$b.$x:function($t=0){return g($t,1);}; | |
} | |
OlderNewer