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
var todoList = [
{ 'completed': false, 'name': 'thing 1' },
{ 'completed': true, 'name': 'thing 2' },
]
function addTaskToList(list, task){
// Add `task` to `list`
list.push(task);
}
(function (window) {
'use strict';
// Your starting point. Enjoy the ride!
    $(document).ready(function(){
$('#new-todo').on('keypress', function (e) {
if(e.which == 13) {
var newTask = $('#new-todo').val();
console.log(newTask);
var newItem =
$(document).ready(function() {
$('#new-todo').on('keypress', function(event) {
// If the "Enter" key is pressed...
if (event.which == 13) {
//append to the <ul>
var inputVal = $('#new-todo').val();
// Grab the value of the `#new-todo` <input> element...
var newTask = // Use this template...
@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):
@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 / 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 / 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 / .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 / 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 / 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