Skip to content

Instantly share code, notes, and snippets.

# This file belongs in the my_target directory.
# Start from a base image you like.
FROM gcr.io/google-appengine/python
# Run ordinary commands to set up the environment the way you like.
# Read more about Docker to see what else you can do here.
RUN pip install NumPy
USER root
RUN mkdir -p /var/local
COPY startup.sh /var/local
@sdevani
sdevani / promise.js
Last active August 29, 2015 14:24
Creating Promises
// This is `promiseSetTimeout` which is a wrapper around `setTimeout`
// `promiseSetTimeout` manually builds out the `then` function to its result
// in order to demonstrate how promises work
var promiseSetTimeout = function(time) {
var result = {};
var callbacks = [];
// `then` is a method that will take the callback and store
// it to be used later. In a promise-less world, this would
// be the callback function inserted in the call to `setTimeout`.
@sdevani
sdevani / db.rb
Created May 12, 2014 19:53
Creating Projects using a database class (no database included)
module TM
class DB
attr_reader :projects
def initialize
@projects = {}
@project_count = 0
end
def create_project(data)
module TM
class DB
attr_reader :tasks, :projects
def initialize
@projects = {}
@project_count = 0
end
def create_project(data)
end
@sdevani
sdevani / ttt.js
Created May 2, 2014 15:00
Tic Tac Toe Solution
// Using NaN instead of null is a clever hack. See checkForWinner for details.
var spaces = [
NaN, NaN, NaN,
NaN, NaN, NaN,
NaN, NaN, NaN
];
var player1 = 'veggies';
var player2 = 'junkfood';
@sdevani
sdevani / tree.rb
Created April 28, 2014 18:47
On the way to building a tree
class Tree
def initialize
@root = nil
end
def add_node(value)
end
def ensure_consistency(node)
if node.nil?