Skip to content

Instantly share code, notes, and snippets.

View andrew's full-sized avatar

Andrew Nesbitt andrew

View GitHub Profile
@remy
remy / vat.md
Last active September 14, 2015 14:15
Testing logic for when VAT is applied

VAT Rules

Capture:

  • COUNTRY
  • VAT (optional and validated)
IF country IS "GB"
  ADD_VAT
IF country IS IN (eu) AND vat IS EMPTY
@camillebaldock
camillebaldock / oyster.rb
Last active February 4, 2017 13:43
Oyster journey history scraping script
require 'rubygems'
require 'capybara'
require 'capybara/dsl'
require 'capybara/poltergeist'
require 'awesome_print'
Capybara.run_server = false
Capybara.current_driver = :poltergeist
class Oyster
@sole
sole / titles.html
Created April 16, 2014 10:19
Best titles list ever
<select name="title">
<option value=""></option>
<option value="Mr">Mr</option>
<option value="Mrs">Mrs</option>
<option value="Miss">Miss</option>
<option value="Ms">Ms</option>
<option value="Dr">Dr</option>
<option value="Admiral">Admiral</option>
<option value="Air Comm">Air Comm</option>
<option value="Ambassador">Ambassador</option>
@ajfisher
ajfisher / firmatatest.js
Last active December 22, 2019 08:15
Serial comms over hardware UART for Johnny-Five between Arduino and a Raspberry Pi
var firmata = require('firmata');
var repl = require('repl');
var board = new firmata.Board('/dev/ttyAMA0',function(err){
//arduino is ready to communicate
if (err) {
console.log("err:" + err);
return;
}
console.log("Firmata Firing LEDs");
@gtfierro
gtfierro / miner
Last active January 4, 2016 07:09
GITCOIN
#!/bin/bash
set -eu
if [ "$#" != 2 ]; then
echo >&2 "Usage: $0 <clone_url> <public_username>
A VERY SLOW mining implementation. This should give you an idea of
where to start, but it probably won't successfully mine you any
Gitcoins.
@kdzwinel
kdzwinel / trilateration.js
Created January 3, 2014 09:35
Simple trilateration algorithm implementation in JavaScript.
function getTrilateration(position1, position2, position3) {
var xa = position1.x;
var ya = position1.y;
var xb = position2.x;
var yb = position2.y;
var xc = position3.x;
var yc = position3.y;
var ra = position1.distance;
var rb = position2.distance;
var rc = position3.distance;
@lauris
lauris / github-vim.js
Created December 13, 2013 11:44
Github Vim
ace.require("ace/lib/net").loadScript("https://raw.github.com/ajaxorg/ace-builds/master/src-min-noconflict/keybinding-vim.js", function() {
e = document.getElementById("ace-editor").env.editor;
e.setKeyboardHandler(ace.require("ace/keyboard/vim").handler);
})
@busterbenson
busterbenson / markov_tweets.rb
Created September 25, 2013 05:05
How I do @buster_ebooks.
#!/usr/bin/ruby
# Make sure you have these gems installed
require 'rubygems'
require 'thread'
require 'csv'
require 'twitter'
require 'marky_markov'
# Create a new Twitter account that you'd like to have your auto-tweets posted to

Rough outline of asset deployment strategy

Goals

  • Separate front end "client" deployment and build process from backend deployment.
  • Not necessarily have to create two completely distinct applications (because of authentication difficulties etc), but could go in that direction if needed.
  • Migratable to from the asset pipeline & compatible with rails.
  • Support coffeescript, sass compilation.
  • Allow lightweight "staging" clients to be deployed using the existing backend. Ideally even use the production backend with a development client.
  • Fast compilation and deployment.
@saihoooooooo
saihoooooooo / timer.coffee
Last active December 18, 2015 18:49
Message timer for hubot.
# Description:
# alarm wo narase!!
#
# Commands:
# hubot timer <int> [<text>] - <int> byou go ni <text> wo hyouji
# hubot alarm 12:34 [<text>] - 12:34 ni <text> wo hyouji
module.exports = (robot) ->
robot.respond /timer (\d+) ?(.+)?/i, (msg) ->
time = msg.match[1] * 1000