Skip to content

Instantly share code, notes, and snippets.

View lukemorton's full-sized avatar

Luke Morton lukemorton

View GitHub Profile
function getAlphabet() {
return 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('');
}
function hasLetterFn(str) {
str = str.toUpperCase();
return function (isPangram, letter) {
return isPangram && (str.indexOf(letter) > -1);
}
@lukemorton
lukemorton / gist:1364437
Created November 14, 2011 16:58
CodeMirror mustache support
CodeMirror.defineMode("mustache", function (config, parserConfig) {
var mustacheOverlay = {
token: function (stream, state) {
if (stream.match("{{")) {
while ((ch = stream.next()) != null)
if (ch == "}" && stream.next() == "}") break;
return "mustache";
}
while (stream.next() != null && !stream.match("{{", false)) {}
return null;
@lukemorton
lukemorton / base.rb
Created September 21, 2011 09:59 — forked from james/gist:1231642
attr_accessor parsed as a method variable when setting with a get
class Base
attr_accessor :configuration
def initialize(configuration)
@configuration = configuration
end
def do_a_thing()
# specifying the parenthesis below resolves your problem
configuration = configuration() + 1
@lukemorton
lukemorton / ajax.php
Created August 4, 2011 09:12 — forked from smgladkovskiy/Controller_Ajax_Template.php
Ajax Template Controller for Kohana 3.1
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* AJAX Helper
*
* @author Sergei Gladkovskiy <smgladkovskiy@gmail.com>
* @author Luke Morton
*/
class AJAX {
/**
@lukemorton
lukemorton / event-source.html
Created June 1, 2011 16:46 — forked from rwaldron/event-source.html
EventSource: The Glorified Long Polling Machine
Open your console.
<script src="event-source.js"></script>
<?php
require_once('MustacheLambda.php'); // Ensure feature/higher-order-sections branch !!
class MyMustache extends Mustache {
public function name()
{
return "Luke";
}