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 nice_duration($seconds, $maxFragments = 0) { | |
// Define time periods | |
$periods = array ( | |
'y' => 31556926, | |
'mo' => 2629743, | |
'wks' => 604800, | |
'd' => 86400, | |
'h' => 3600, | |
'm' => 60, | |
's' => 1 |
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
/** | |
* works for json objects. will replace all | |
* keys and values with the result of the | |
* closure. | |
*/ | |
function walk_recursive($obj, $closure) { | |
if ( is_object($obj) ) { | |
$newObj = new stdClass(); | |
foreach ($obj as $property => $value) { | |
$newProperty = $closure($property); |
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
# this site has a good install writeup with custom weighting handler | |
# https://sites.google.com/site/profileswapnilkulkarni/tech-talk/howtoinstallnutchandsolronubuntu1004 | |
# grab the solr src | |
curl -o solr-3.6.1.tgz http://apache.ziply.com/lucene/solr/3.6.1/apache-solr-3.6.1-src.tgz | |
# untar the beast | |
tar xfvz solr-3.6.1.tgz | |
cd apache-solr* |
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
{ | |
"categories":{ | |
"1":"cms", | |
"2":"message-boards", | |
"3":"database-managers", | |
"4":"documentation-tools", | |
"5":"widgets", | |
"6":"web-shops", | |
"7":"photo-galleries", | |
"8":"wikis", |
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 | |
/** | |
* Read apps.js from stdin and write out valid JSON to stdout | |
*/ | |
$wappalyzerJs = readfile('php://input'); | |
$handle = fopen('php://stdin', 'r'); | |
$wappalyzerJs = ''; | |
while(!feof($handle)) { |
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
# Found this template here... https://www.varnish-cache.org/trac/wiki/VCLExampleTemplateWordpressNopurge | |
backend default { | |
.host = "127.0.0.1"; | |
.port = "8080"; | |
} | |
sub vcl_recv { | |
if (req.http.Accept-Encoding) { | |
#revisit this list |
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
require_once "phpwebdriver/WebDriver.php"; | |
$webdriver = new WebDriver("localhost", "4444"); | |
$webdriver->connect("firefox"); | |
$webdriver->get("http://slashdot.org"); | |
$links = $webdriver->findElementsBy(LocatorStrategy::tagName, "a"); | |
$getLinksScript = <<<EOT |
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
{ | |
"AWSTemplateFormatVersion" : "2010-09-09", | |
"Description" : "Node.js server, cfn-create-stack NODEJS --capabilities CAPABILITY_IAM --parameters KeyName=KO_Keypair;InstanceType=m1.small;SecurityGroupName=default --disable-rollback --template-file nodeform.js", | |
"Parameters" : { | |
"KeyName" : { | |
"Description" : "Name of an existing EC2 KeyPair to enable SSH access", | |
"Type" : "String" | |
}, |
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
# my node AMI - IMAGE ami-bcccb2d5 | |
on beanstalk, you can see node logs at /var/log/nodejs/nodejs.log | |
on beanstalk, if you proxy via nginx, check those logs here /var/log/nginx/error.log | |
proper way to make a mod to a repo and grab it with npm (http://debuggable.com/posts/how-to-fork-patch-npm-modules:4e2eb9f3-e584-44be-b1a9-3db7cbdd56cb) | |
Fork the project on GitHub | |
Clone the fork to your machine | |
Fix the bug or add the feature you want |
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
<html> | |
<head> | |
<title>Test Browser Location 2.1</title> | |
</head> | |
<style> | |
body { | |
font-family:Verdana,Arial,Helvetica; | |
font-size:12px; | |
} | |
#map { |