This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Josiah Carlson - Programming Challange from Erann Gat: | |
# http://www.flownet.com/ron/papers/lisp-java/ | |
# Given a list of words and a list of phone numbers, find all the ways that | |
# each phone number can be expressed as a list of words. | |
from collections import defaultdict | |
import sys | |
MAPPING = {'e':0, 'j':1, 'n':1, 'q':1, 'r':2, 'w':2, 'x':2, 'd':3, 's':3, | |
'y':3, 'f':4, 't':4, 'a':5, 'm':5, 'c':6, 'i':6, 'v':6, 'b':7, 'k':7, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
App.Models.Task = App.Models.Base.createModel('Task', 'tasks', { | |
name: 'TEXT', | |
note: 'TEXT', | |
due_at: 'DATE', | |
is_completed: 'TEXT', | |
completed_at: 'TEXT', | |
category_id: 'TEXT', | |
event_id: 'INTEGER', | |
has_reminders: 'TEXT', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Avoid `console` errors in browsers that lack a console. | |
(function() { | |
var noop = function noop() {}; | |
var methods = [ | |
'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error', | |
'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log', | |
'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd', | |
'timeStamp', 'trace', 'warn' | |
]; | |
var length = methods.length; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--[if lt IE 7]> | |
<p class="chromeframe">You are using an outdated browser. <a href="http://browsehappy.com/">Upgrade your browser today</a> or <a href="http://www.google.com/chromeframe/?redirect=true">install Google Chrome Frame</a> to better experience this site.</p> | |
<![endif]--> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!!! | |
/[if lt IE 7] <html class='no-js lt-ie9 lt-ie8 lt-ie7'> | |
/[if IE 7] <html class='no-js lt-ie9 lt-ie8'> | |
/[if IE 8] <html class='no-js lt-ie9'> | |
/ [if gt IE 8]><! | |
%html.no-js | |
/ <![endif] | |
%head | |
%meta{charset : "utf-8"}/ | |
%meta{http-equiv : "X-UA-Compatible", content : "IE=edge,chrome=1"}/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_cache_path_url | |
if is_mobile_request? | |
"cached_page#{request.path.gsub("/","")}_mobile" | |
else | |
"cached_page#{request.path.gsub("/","")}_desktop" | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var proto = { | |
sentence : 4, | |
probation : 2 | |
} | |
var makePrisoner = function(name,id) { | |
var prisoner = Object.create(proto); | |
prisoner.name = name; | |
prisoner.id = id; | |
return prisoner; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Array.prototype.largest_number =function() { | |
var largest; | |
for (var i=0; i<this.length; i++) { | |
var num = this[i]; | |
if(largest === undefined){ | |
largest = num; | |
} else if (num > largest) { | |
largest = num; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var prompt = require('prompt'); | |
GameOfLife = { | |
input: {}, | |
grid: [], | |
init: function(){ | |
this.prompt(); | |
}, | |
// Prompt for input | |
prompt: function(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Array.prototype.sumPairs = function(){ | |
var arr = this, pairs = [], subPair, currentElem, compareElem; | |
for(var i = 0; i < arr.length; i++){ | |
currentElem = arr[i]; | |
for(var j = i+1; j<arr.length; j++){ | |
compareElem = arr[j]; | |
if((currentElem + compareElem) === 100){ | |
subPair = new Array(); | |
subPair.push(currentElem); |
OlderNewer