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(){ | |
function addEventListener(element, event, listener) { | |
if (typeof listener != 'function') | |
return; | |
if (event == 'ready' && element == document){ | |
if (/(loaded|complete)/.test(document.readyState)) { | |
listener(); | |
return; | |
} |
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() { | |
var baseUrl = 'http://alexgorbatchev.com/pub/sh/current'; | |
var theme = 'Default'; | |
var bloggerMode = true; | |
function addScript (uri) { | |
var e = document.createElement('script'); e.type = 'text/javascript'; | |
e.src = baseUrl + uri; | |
document.getElementsByTagName('script')[0].parentNode.appendChild(e); | |
} |
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 | |
set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__)); | |
include_once 'JsonRpc.php'; | |
$config = include 'config.php'; | |
$connect = new JsonRpc_Connection($config['host'], $config['port']); | |
$t1 = microtime(true); | |
for ($i = 0; $i < 10000; $i++) { |
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 | |
declare(ticks = 1); | |
/** | |
* ThreadManager | |
*/ | |
class ThreadManager extends CApplicationComponent | |
{ | |
const E_WORKER = 255; | |
protected static $isChildWorker = false; |
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 | |
if ($argc != 3) { | |
echo 'Usage:', PHP_EOL, "\tphp ", basename($argv[0]), ' <source directory 1> <source directory 2>', PHP_EOL; | |
exit(1); | |
} | |
function token_get_namespaces($tokens) | |
{ | |
$tokens = array_map( | |
function ($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
CREATE OR REPLACE FUNCTION random_int_array(dim integer, min integer, max integer) RETURNS integer[] AS $BODY$ | |
begin | |
return (select array_agg(round(random() * (max - min)) + min) from generate_series (0, dim)); | |
end | |
$BODY$ LANGUAGE plpgsql; | |
-- usage example | |
select random_int_array(15, 6, 40); | |
-- return example |
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
http://www.ekho.name/2012/03/pgagent-debianubuntu.html |
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 hitch(func, context){ | |
return function(){ | |
return func.apply(context, arguments); | |
}; | |
}; | |
// example will out to browser console object myOwnContext after clicking on specified element | |
$('...').click( | |
var myOwnContext = {prop: 1}; | |
hitch(function(){ console.dir(this); }, myOwnContext); |
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
# Usage: | |
# 1. Drop this file into lib/capistrano/submodule_strategy.rb | |
# 2. Add the following to your Capfile: | |
# require './lib/capistrano/submodule_strategy' | |
# 3. Add the following to your config/deploy.rb | |
# set :git_strategy, SubmoduleStrategy | |
require 'capistrano/git' | |
module SubmoduleStrategy |
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 | |
/** | |
* CIDR.php | |
* | |
* Utility Functions for IPv4 ip addresses. | |
* Supports PHP 5.3+ (32 & 64 bit) | |
* @author Jonavon Wilcox <[email protected]> | |
* @revision Carlos Guimarães <[email protected]> | |
* @version Wed Mar 12 13:00:00 EDT 2014 | |
*/ |
OlderNewer