Skip to content

Instantly share code, notes, and snippets.

View ColinEberhardt's full-sized avatar

Colin Eberhardt ColinEberhardt

View GitHub Profile
@ColinEberhardt
ColinEberhardt / gist:5334470
Last active December 15, 2015 22:39
An XSLT siteswap validator by Colin E.
The aim was to create a vaildator that takes an XML document of the following form and annotate
it to state whether each individual siteswap was valid or invalid:
<?xml version="1.0" encoding="ISO-8859-1"?>
<siteswaps>
<siteswap>34535</siteswap>
<siteswap>543</siteswap>
<siteswap>441</siteswap>
<siteswap>97531</siteswap>
<siteswap>24234</siteswap>
@ColinEberhardt
ColinEberhardt / gist:7336907
Created November 6, 2013 14:28
beautify - selenium webdriverjs test
// https://github.com/dmachi/webdriver-js
// https://code.google.com/p/selenium/source/browse/javascript/webdriver/webdriver.js
// http://www.seleniumhq.org/docs/03_webdriver.jsp#introducing-webdriver
// $x("//ul[@class='themes']");
var webdriver = require('selenium-webdriver'),
assert = require("assert"),
test = require('selenium-webdriver/testing');
test.describe('Copy default theme', function () {
@ColinEberhardt
ColinEberhardt / gist:7692235
Created November 28, 2013 13:57
nodejitsu deploy issue
info: Welcome to Nodejitsu ColinEberhardt
info: jitsu v0.13.3, node v0.10.13
info: It worked if it ends with Nodejitsu ok
info: Executing command deploy
info: Analyzing application dependencies in node app.js
debug: { method: 'GET',
debug: uri: 'https://api.nodejitsu.com/apps/ColinEberhardt/JitsuTestColin',
debug: headers:
debug: { Authorization: '**************************************************
***********************',
@ColinEberhardt
ColinEberhardt / gist:7693111
Last active December 29, 2015 15:49
package.json for the app that is causing problems
{
"name": "JitsuTestColin",
"description": "Beautify - iOS App Styling",
"private": true,
"dependencies": {
"bootstrap": "git://github.com/twbs/bootstrap.git#v3.0.0",
"bootstrap-browserify": "2.1.1",
"browserify": "2.35.1",
"express": "3.4.4",
"jquery-browserify": "1.8.1",
@ColinEberhardt
ColinEberhardt / gist:8109474
Created December 24, 2013 06:18
After applying the style guide
//
// RWViewController.m
// RWReactivePlayground
//
// Created by Colin Eberhardt on 18/12/2013.
// Copyright (c) 2013 Colin Eberhardt. All rights reserved.
//
#import "RWViewController.h"
#import "RWDummySignInService.h"
@ColinEberhardt
ColinEberhardt / gist:8109483
Last active January 1, 2016 07:09
Before applying the style guide
//
// RWViewController.m
// RWReactivePlayground
//
// Created by Colin Eberhardt on 18/12/2013.
// Copyright (c) 2013 Colin Eberhardt. All rights reserved.
//
#import "RWViewController.h"
#import "RWDummySignInService.h"
@ColinEberhardt
ColinEberhardt / gist:af7c4bca378fe0333f1f
Created June 25, 2014 21:43
A demonstration of Swift sequences
// a demonstration of Swift sequences
// a sequence that lazily creates a Fibonacci sequence
class Fibonacci : Sequence {
let id:String
init(_ id: String) {
self.id = id;
}
import UIKit
// create a 'scene' with a red square
let view = UIView(frame: CGRectMake(0, 0, 300, 100))
let subView = UIView(frame: CGRectMake(0,0,50,50))
subView.backgroundColor = UIColor.redColor()
view.addSubview(subView)
// add gravity
let animator = UIDynamicAnimator(referenceView: view)
@ColinEberhardt
ColinEberhardt / gist:133147b629560b6def9d
Created September 17, 2014 09:15
Browser test run for ToDoMVC
>> Local Npm module "grunt-contrib-jshint" not found. Is it installed?
Running "simplemocha:files" (simplemocha) task
(1 of 1624) pass: TodoMVC - agilityjs, No Todos, should hide #main and #footer
(2 of 1624) pass: TodoMVC - agilityjs, New Todo, should allow me to add todo items
(3 of 1624) pass: TodoMVC - agilityjs, New Todo, should clear text input field when an item is added
(4 of 1624) pass: TodoMVC - agilityjs, New Todo, should append new items to the bottom of the list
(5 of 1624) pass: TodoMVC - agilityjs, New Todo, should trim text input
(6 of 1624) pass: TodoMVC - agilityjs, New Todo, should show #main and #footer when items added
(7 of 1624) pass: TodoMVC - agilityjs, Mark all as completed, should allow me to mark all items as completed
let array = ["P","Q","R","S","T","P","R","A","T","B","C","P","P","P","P","P","C","P","P","J"]
extension Array {
func unique<T: Equatable>() -> [T] {
return self.reduce([T](), combine: { (array, value) -> [T] in
var result = array
let valAsT = value as T
if (!contains(array, valAsT)) {
result.append(valAsT)
}