Skip to content

Instantly share code, notes, and snippets.

@benhowes
benhowes / gist:8801605
Last active August 29, 2015 13:56
gulp upload to s3
/*
* Uses https://github.com/nkostelnik/gulp-s3 with
* Gulpjs: http://gulpjs.com/
*/
var s3_creds = {
"key": "AKIAI3Z7CUAFHG53DMJA",
"secret": "acYxWRu5RRa6CwzQuhdXEfTpbQA+1XQJ7Z1bGTCx",
"bucket": "dev.example.com",
"region": "eu-west-1"
### Keybase proof
I hereby claim:
* I am benhowes on github.
* I am benhowes (https://keybase.io/benhowes) on keybase.
* I have a public key whose fingerprint is 0B37 080D A5E5 C96B F02D C14C E29D 82DA D3AE C5F4
To claim this, I am signing this object:
/* Sample of the events which will be used to replay */
[
{
"collection": "viewChange",
"delta": 0,
"frame": 31,
"timestamp": 1398613195820
},
.....
{
@benhowes
benhowes / dictionary.js
Last active August 29, 2015 14:01
Files for Zoetrope i18n blog post
var langStrings={
"en": {
"callToAction": {
"desktop": "click and drag image to rotate in 3D",
"mobile": "swipe image to rotate in 3D"
},
"inlineCallToAction": {
"desktop": "click to rotate",
"mobile": "tap to rotate"
},
@benhowes
benhowes / linnlive.csv
Created August 20, 2014 14:36
Linnlive exports
SKU PropertyType PropertyName PropertyValue
24994 Attribute zoetrope_uuid 5346656cc24f2850912ad981
24994 Attribute zoetrope_start_position 0
24994 Attribute IMAGE1 http://d34tuy4jppw3dn.cloudfront.net/5346656cc24f2850912ad981/1000/0.jpg
23175 Attribute zoetrope_uuid 53455f67c24f282735cb9806
23175 Attribute zoetrope_start_position 0
23175 Attribute IMAGE1 http://d34tuy4jppw3dn.cloudfront.net/53455f67c24f282735cb9806/1000/0.jpg
24352 Attribute zoetrope_uuid 53456b22c24f282735cb980b
24352 Attribute zoetrope_start_position 0
24352 Attribute IMAGE1 http://d34tuy4jppw3dn.cloudfront.net/53456b22c24f282735cb980b/1000/0.jpg
@benhowes
benhowes / basicPosting.php
Last active August 29, 2015 14:09
Zapier Webhook posting
<?php
$params = array(
'name' => 'Erlich Bachman',
'email' => 'erl@pied-piper.io',
});
//send Zapier webhook
$response = drupal_http_request('https://zapier.com/hooks/catch/.../', array(
'headers' => array('Content-Type' => 'application/json', 'Accept' => 'application/json'),
@benhowes
benhowes / gist:f0efa87467fe45d62044
Created May 24, 2015 15:19
How Many 5-permutations that contain at least one number are there for the following set {a,b,c,d,e,f,g,1,2,3,4,5}
from itertools import permutations
s = ['a','b','c','d','e','f','g',1,2,3,4,5]
perms = permutations(s,5)
# The following line does this:
# For each 5-permutation, see if there is an instance of an integer in it (isinstance).
# If there is, add one to a temporary list which we then sum to give the total count.
count = sum([1 for p in perms if sum([isinstance(_, int) for _ in p])])
print count
<predefinedLocation id="Link114001101">
<predefinedLocationName><value lang="en">A50 westbound exit for A515 near Sudbury (west)</value></predefinedLocationName>
<predefinedLocation xsi:type="Linear">
<tpeglinearLocation>
<tpegDirection>westBound</tpegDirection>
<tpegLocationType>segment</tpegLocationType>
<to xsi:type="TPEGJunction">
<pointCoordinates>
<latitude>52.892544</latitude>
<longitude>-1.775278</longitude>
@benhowes
benhowes / gist:2377570
Created April 13, 2012 15:13
Pandaboard stereo camera rig

Stereo camera rig.

I am attempting to make a stereo camera rig for the pandaboard. The aim is to release it as an open source hardware project when it is in a working form.

Hardware

Some images of the hardware can be found here: http://imgur.com/a/3L5l8

System layout:

@benhowes
benhowes / Gamblers Falacy.coffee
Created August 21, 2012 20:16
prove to your intuition that you cannot predict coin tosses any better than chance with a knowledge of the recent flips!
runs = 1000000
Math.RandomInteger = (n, m) ->
if not m then m = 1 # default range starts at 1
max = if n > m then n else m # doesn<q>t matter which value is min or max
min = if n is max then m else n # min is value that is not max
d = max - min + 1 # distribution range
Math.floor(Math.random() * d + min)