Skip to content

Instantly share code, notes, and snippets.

@calebpowell
calebpowell / mks_checkpoints_to_git.py
Last active September 10, 2015 18:18 — forked from XenuIsWatching/mks_checkpoints_to_git.py
MKS fast-import script for git
#!/usr/bin/python
#
#Copyright (c) 2015 Ryan McClelland
#
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation files (the "Software"), to deal
#in the Software without restriction, including without limitation the rights
#to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
#copies of the Software, and to permit persons to whom the Software is
#furnished to do so, subject to the following conditions:
@calebpowell
calebpowell / gist:5118620
Last active December 14, 2015 16:58
08_inheritance
// 1. Write a class to support the following code:
var Person = function(name) {
this.name = name;
this.getName = function(){ return this.name;}
}
var thomas = new Person('Thomas');
var amy = new Person('Amy');
thomas.name // --> "Thomas"
// Part 1.
// Implement a function prototype extension that caches function results for
// the same input arguments of a function with one parameter.
//
// For example:
// Make sin(1) have the result of Math.sin(1), but use a cached value
// for future calls.
//
// Part 2.
// Use this new function to refactor the code example.
// Exercise 1 - OO || !OO
// Define a data structure for cars (make and color), and a function
// that logs a string like "I'm a red Mercedes" to the console.
// Make two versions: a functional version, and a object-oriented version.
function logCar(car) {
console.log(["I'm a", car.color, car.make].join(' '));
}
function Car(make, color) {