Skip to content

Instantly share code, notes, and snippets.

View mtthwgry's full-sized avatar
👀

Matthew Gray mtthwgry

👀
View GitHub Profile
@mtthwgry
mtthwgry / object_oriented_pig_latinifier.rb
Last active February 14, 2017 00:08
pig latin solution
class ObjectOrientedPigLatinifier
def self.translate(string)
string.split(" ").map{ |word| new(word).translate }.join(" ")
end
def initialize(raw_word)
@raw_word = raw_word
@pig_latin_word = ""
@punctuation = ""
end
@mtthwgry
mtthwgry / intro-to-fp-racket
Last active August 29, 2015 14:17
What a fucking Racket...I'm hooked...
#lang racket
; sq : number -> number
(define (sq num) (* num num))
; f-to-c : number -> number
(define (f-to-c temp) (/ (- temp 32) 1.8))
; how-cold : integer -> string
(define (how-cold temp)
(if (< (f-to-c temp) 0) "brrr" "could be worse"))
@mtthwgry
mtthwgry / wealthfront-js-prep.js
Last active August 29, 2015 14:16
Prep for WealthFront
// JavaScript variables belong to one of the following scopes: global or local(function).
// Basically, any variable defined outside of a function is a global variable. Variables
// defined inside of a function are scoped narrowly to that function, and any other
// functions defined within the scope of that function (explicit use of the var keyword assumed).
var myName = "john";
var capitalizeMyName = function() {
myName = myName.substring(0).toUpperCase() + myName.slice(1);
var name = myName;