Skip to content

Instantly share code, notes, and snippets.

Avatar

Kirk Ouimet kirkouimet

View GitHub Profile
View game.html
<html>
<head>
<style>
@-webkit-keyframes struck {
0% { -webkit-transform: translateX(10px); }
50% { -webkit-transform: translateX(0); }
100% { -webkit-transform: translateX(10px); }
@kirkouimet
kirkouimet / php-analytics.php
Created Nov 14, 2011
PHP analytics function
View php-analytics.php
function getAnalytics() {
$user = $_SERVER['HTTP_USER_AGENT'];
$browser = 'Unknown';
$platform = 'Unknown';
$version= '';
// First get the platform?
if(preg_match('/linux/i', $user)) {
$platform = 'Linux';
}
View aspect-ratio-rounded.php
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);
View gist:3146270
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 ...
View gist:3739383
*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
@kirkouimet
kirkouimet / gist:5596828
Created May 17, 2013
Add baconify method to the string class
View gist:5596828
String.prototype.baconify = function() {
return this.replace(/({|})/gi, 'BACON');
}
'{"jsonKey":"jsonValue"}'.baconify();
//"BACON"jsonKey":"jsonValue"BACON"
@kirkouimet
kirkouimet / CopyAsanaTasks.php
Last active Dec 18, 2015 — forked from mhdhejazi/CopyAsanaTasks.php
Allows you to duplicate a project in Asana and put it in another workspace
View CopyAsanaTasks.php
<?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);
View overscroll.html
<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>
View gist:856492387755f34800759bef2661355f
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) {
@kirkouimet
kirkouimet / gist:5208767
Created Mar 20, 2013
Scrape titles from Reddit with node.js and node.io
View gist:5208767
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);
});
});
You can’t perform that action at this time.