This file contains hidden or 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
#put this in a ./.git/hooks/ file, like post-update | |
#exec update.appfog.bat | |
#update.appfog.bat content | |
::activate ruby | |
/E:ON /K e:\Ruby200-x64\bin\setrbvars.bat | |
::move to application location | |
cd server/ | |
call af login --email [email protected] --password blank123 | |
::timeout /t 60 |
This file contains hidden or 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
//lock only from CLI mode, usually for cronjobs left in public !! Do not make this ! | |
if (strpos(strtolower(PHP_SAPI),'cli') === false) | |
{ | |
die(0); | |
} |
This file contains hidden or 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
Settings for Current Browsers | |
The table below shows the number of connections per server supported by current browsers for HTTP/1.1 as well as HTTP/1.0. | |
Browser HTTP/1.1 HTTP/1.0 | |
IE 6,7 2 4 | |
IE 8 6 6 | |
Firefox 2 2 8 | |
Firefox 3 6 6 | |
Safari 3,4 4 4 | |
Chrome 1,2 6 ? |
This file contains hidden or 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 | |
//http://sourceforge.net/projects/precompiledbin/ | |
//firefox addon https://addons.mozilla.org/en-US/firefox/addon/the-easiest-xdebug/?src=api | |
//tutorial http://devzone.zend.com/1120/introducing-xdebug/ | |
if (APPLICATION_ENV == 'development') | |
xdebug_start_trace('E:\wamp\tmp\xdebug\callgrind.brentz.',XDEBUG_TRACE_HTML); | |
//XDEBUG_TRACE_HTML XDEBUG_TRACE_COMPUTERIZED XDEBUG_TRACE_APPEND | |
This file contains hidden or 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
/** Calculates, from two set of coord, if two nodes are adjacents. | |
* @return bool|null True if they are adiacents, null if the coords are not valid or are the same. | |
*/ | |
public static function areNodeAdjacents($coord_1_norm,$coord_2_norm) | |
{ | |
if ($coord_1_norm['x'] === $coord_2_norm['x'] AND $coord_1_norm['y'] === $coord_2_norm['y'])//or is the same planet .. | |
return null; | |
//the formula |
This file contains hidden or 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
/** | |
Add a temporal message to the interface that with auto deleting feature | |
*/ | |
var uiAddMessage = function(text) | |
{ | |
$('<div>'+text+'</div>') | |
.prependTo(this.dom_messages)//$('#parent') | |
.show(100) | |
.delay(3000 + (this.dom_messages.children().length * 700))//we must add time of lots of messages are on | |
.hide(200) |
This file contains hidden or 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
Object.keys(myArray).length |
This file contains hidden or 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
// Each time score is added, tween the value. | |
function addScore(score) { | |
// Save the new score | |
this.newScore = score; | |
// Create a tween that will update the "displayScore", which | |
// we use to display the changing number. | |
var tween = createjs.Tween.get(this).to({displayScore:score}, 800); | |
// For this example, set a local "scope" so the onChange |
This file contains hidden or 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
/* cruel way to sum your global vars */ | |
function roughSizeOfObject( object ) { | |
var objectList = []; | |
var stack = [ object ]; | |
var bytes = 0; | |
while ( stack.length ) { | |
var value = stack.pop(); |
This file contains hidden or 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 bytesToSize(bytes) { | |
var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB']; | |
if (bytes == 0) return 'n/a'; | |
var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024))); | |
return Math.round(bytes / Math.pow(1024, i), 2) + ' ' + sizes[i]; | |
}; |