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 getAnalytics() { | |
$user = $_SERVER['HTTP_USER_AGENT']; | |
$browser = 'Unknown'; | |
$platform = 'Unknown'; | |
$version= ''; | |
// First get the platform? | |
if(preg_match('/linux/i', $user)) { | |
$platform = 'Linux'; | |
} |
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
public static function aspectRatioRounded($a, $b) { | |
$total = $a + $b; | |
for($i = 1; $i <= 40; $i++) { | |
$arx = $i * 1.0 * $a / $total; | |
$brx = $i * 1.0 * $b / $total; | |
if($i == 40 || ( | |
abs($arx - round($arx)) <= 0.02 && | |
abs($brx - round($brx)) <= 0.02)) { | |
# Accept aspect ratios within a given tolerance | |
return round($arx).'x'.round($brx); |
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
me: hey another win for Scan this month: our latest invoice from our lawyers was only $65 | |
Ben: aaah nice! | |
me: lowest one ever | |
Ben: that must have been like one of the lawyers had a dream and we were in it, so he charged 65 | |
... checks invoice on Dropbox ... |
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
*Directions to Kincaid’s* | |
60 Bay View Place | |
Burlingame, CA 94010 | |
From the South: | |
Take Highway 101 North | |
Take the Anza Blvd. exit | |
Turn right onto Airport Blvd. | |
Turn left onto Bay View Place |
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
require('node.io').scrape(function() { | |
this.getHtml('http://www.reddit.com/', function(err, $) { | |
var stories = []; | |
$('.entry .title').each(function(title) { | |
stories.push(title.text); | |
}); | |
this.emit(stories); | |
}); | |
}); |
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
String.prototype.baconify = function() { | |
return this.replace(/({|})/gi, 'BACON'); | |
} | |
'{"jsonKey":"jsonValue"}'.baconify(); | |
//"BACON"jsonKey":"jsonValue"BACON" |
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 asanaRequest($methodPath, $httpMethod = 'GET', $body = null) { | |
$apiKey = 'ASANA_API_KEY_HERE'; /// Get it from http://app.asana.com/-/account_api | |
$url = "https://app.asana.com/api/1.0/$methodPath"; | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, $url); | |
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC ) ; | |
curl_setopt($ch, CURLOPT_USERPWD, $apiKey); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
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
<html> | |
<head> | |
<style> | |
@-webkit-keyframes struck { | |
0% { -webkit-transform: translateX(10px); } | |
50% { -webkit-transform: translateX(0); } | |
100% { -webkit-transform: translateX(10px); } |
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
<html> | |
<head> | |
<title>Overscrolling HTML Elements in Chromium on OS X using a Trackpad</title> | |
<style> | |
html { | |
font-family: sans-serif; | |
border: 4px solid #00AAFF; | |
} | |
</style> | |
</head> |
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
implement = function(classToReceiveImplementation, classToImplement) { | |
for(var classToImplementProperty in classToImplement) { | |
if(classToReceiveImplementation[classToImplementProperty] === undefined) { | |
//console.log(classToImplementProperty, 'does not exist on class, copying'); | |
classToReceiveImplementation[classToImplementProperty] = cloneProperty(classToImplement[classToImplementProperty]); | |
} | |
} | |
for(var classToImplementPrototypeProperty in classToImplement.prototype) { | |
if(classToReceiveImplementation.prototype[classToImplementPrototypeProperty] === undefined) { |
OlderNewer