Skip to content

Instantly share code, notes, and snippets.

View tonyhb's full-sized avatar
🕳️
void

Tony Holdstock-Brown tonyhb

🕳️
void
View GitHub Profile
@tonyhb
tonyhb / gulpfile.js
Created March 9, 2014 20:52
Karma + RequireJS: Mismatched anonymous define error
var gulp = require('gulp');
// Plugins
var karma = require('gulp-karma');
// Paths
var basePath = './public/assets/';
var paths = {
spec: basePath + 'spec/'
};
require 'amazon/ecs'
module Amazon
class Ecs
def self.cart_similarities(asin)
opts = {
service: 'AWSECommerceService',
operation: 'CartCreate',
response_group: 'CartSimilarities'
}
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Bitcoin Payroll</title>
<script src="/assets/js/libs/modernizr.js"></script>
<link rel="stylesheet" href="/assets/css/bootstrap.css" />
<link rel="stylesheet" href="/assets/css/flat-ui.css" />
<link rel="stylesheet" href="/assets/css/app.css" />
</head>
set nocompatible " be iMproved
filetype off " required!
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
Bundle 'gmarik/vundle'
" Plugins here
@tonyhb
tonyhb / main.go
Last active August 29, 2015 14:05
Using variable functions to make testing easier
// By assigning next to a variable we can swap out the hello() function in testing with a custom
// implementation
var h = hello
func main() {
fmt.Println(n())
}
func hello() string {
@tonyhb
tonyhb / click.rb
Created September 18, 2014 20:48
RackRequestCounter
# spec/support/click.rb
module Capybara
module Node
class Element < Base
# Override the default implementation of click so that whenever we click
# on something, we also wait for any ajax requests to finish.
def click
synchronize { base.click }
@tonyhb
tonyhb / page.go
Last active August 29, 2015 14:18
Exposing atomic and transactional database methods
package models
import (
"github.com/jmoiron/sqlx"
"github.com/tonyhb/govalidate"
)
type Page struct {
Id int64
Name string
/**
* Set the routes. Each route must have a minimum of a name, a URI and a set of
* defaults for the URI.
*/
Route::set('api', '(<action>(/<id>))')
->defaults(array(
'subdomain' => 'api',
'controller' => 'api',
'action' => 'subdomain',
));
// API
Route::set('api', '(<action>(/<subaction>))')
->defaults(array(
'subdomain' => 'api', // api.domain.com
'controller' => 'api',
'action' => 'index',
));
// Load the website
Route::set('welcome', '(<action>(/<subaction>))')
@tonyhb
tonyhb / Kohana 3 Bash Init Script
Created March 13, 2011 20:03
Kohana initialisation bash script: bash script for a new kohana 3 project (with git).
#! /bin/bash
if [[ $1 == '' ]]; then
echo -e "Which folder do you want to initialise the kohana project in?"
read -a dir
dir=${dir[@]}
else
dir=$@
fi