Skip to content

Instantly share code, notes, and snippets.

View al-the-x's full-sized avatar

David Rogers AKA "AL the X" al-the-x

View GitHub Profile
@al-the-x
al-the-x / conway-simple.js
Created October 2, 2014 15:40
Conway's Game of Life from Week 2 at @TheIronYard--Orlando
/**
* Conway's Game of Life: http://en.wikipedia.org/wiki/Conway's_Game_of_Life
*
*/
@al-the-x
al-the-x / check-writing.js
Created October 7, 2014 14:34
Check Writing + forEach re @TheIronYard--Orlando Coding Dojos
var assert = require('assert');
function test(actual, expected, success){
success = success || 'pass!';
assert(actual === expected) || console.log(success);
}
/**
* Check Writing
@al-the-x
al-the-x / deepEqual.js
Created October 8, 2014 14:08
Write your own `assert.deepEqual()`...
var assert = require('assert');
/**
* @param Array actual
* @param Array expected
* @param String message optional
* @return Boolean
*/
assert.deepEqual = function(actual, expected, message){
/* Then a miracle occurs... */
@al-the-x
al-the-x / dojo.js
Created October 11, 2014 12:15
Code from running a Dojo at @theironyard in Charleston, SC as a guest lecture for @calweb
/** --- TEST CODE --- **/
var expect = chai.expect;
/**
* Next multiple of 3 or 5
* n = 0: 3
* n = 3: 5
* n = 5: 6
* n = 6: 9
* n = 9: 10
@al-the-x
al-the-x / gulpfile.js
Last active August 29, 2015 14:08
Sample gulpfile for live reload...
var gulp = require('gulp'),
connect = require('gulp-connect'),
args = require('yargs')
.alias('p', 'path')
.demand(['path'])
.alias('w', 'watch')
.argv;
gulp.task('connect', function(){
connect.server({
@al-the-x
al-the-x / .bowerrc
Last active August 29, 2015 14:08
Starting point for Coding Dojos in JavaScript using Mocha and Chai
{
"scripts": {
"postinstall": "./node_modules/.bin/wiredep -s index.html"
}
}
@al-the-x
al-the-x / conway.py
Created November 16, 2014 23:13
Implementation of Conway's Game of Life in Python for a potentially infinite board using the `doctest` module: `python -m doctest conway.py`
def coalesce(*args):
return next((a for a in args if a is not None), None)
class Game(dict):
_xmin = _xmax = _ymin = _ymax = None
@property
def bounds(self):
"""
>>> Game((0,0)).bounds
@al-the-x
al-the-x / Look-at-all-the-Comments.markdown
Last active August 29, 2015 14:10
Look at all the Comments

Look at all the Comments

A reference implementation for the students of the FEE 2014 FALL cohort of The Iron Yard Orlando using Angular, Restangular, and the Github API

A Pen by David Rogers on CodePen.

License.

@al-the-x
al-the-x / test--karma.conf.js
Created November 20, 2014 16:56
Sample Karma tests for our `github-comments` Angular JS application...
'use strict';
module.exports = function(config) {
config.set({
basePath : '..', //!\\ Ignored through gulp-karma //!\\
files : [ ] //!\\ Ignored through gulp-karma //!\\
autoWatch : false,
@al-the-x
al-the-x / WPGimmeTicket.py
Last active August 29, 2015 14:10
Trac Plugin for assigning oldest open Ticket to currently authenticated User, even if the `authuser` doesn't have `TICKET_UPDATE` permissions... all for my peeps at @WordPress
from trac.core import *
from trac.env import open_environment
from tracrpc.api import IXMLRPCHandler, expose_rpc
from tracrpc.util import to_timestamp
import trac.ticket.model as model
class WPGimmeTicketRPC(Component):
implements(IXMLRPCHandler)
def xmlrpc_namespace(self):