Skip to content

Instantly share code, notes, and snippets.

View blake41's full-sized avatar

Blake Johnson blake41

  • http://blakejohnson.brandyourself.com/
View GitHub Profile
sentence = <<-something
Steven likes the movies. Blake likes to ride his bike but hates movies.
Blake is taller than steven. Steven is a great teacher.
something
sentence = sentence.gsub("."," ") # you can chain more then one gsub
sentence = sentence.split(" ").collect {|word| word.capitalize}
cont = {}
sentence = <<-something
Steven likes the movies. Blake likes to ride his bike but hates movies.
Blake is taller than steven. Steven is a great teacher.
something
flatiron_school = {:teachers=>[{:name=>"steph"}, {:name=>"uzo"}, {:name=>"blake"}], :students => [{:name => "giancarlo", :grade => 100, :address => "bronx"},{:name => "jamie", :grade => 200, :address => "NJ"}]}
print out the names of the teachers and students
myhash = {:blake => 10, :katie => 10, :steven => 11}
container = []
myhash.each do |name, value|
container << name if value == 10
end
container
# in a method
def find_keys_with_value(value_to_find)
puts "hello"
@blake41
blake41 / keybase.md
Created July 17, 2015 13:12
keybase.md

Keybase proof

I hereby claim:

  • I am blake41 on github.
  • I am blake41 (https://keybase.io/blake41) on keybase.
  • I have a public key whose fingerprint is E5CA D432 2A23 897E 282F 09F8 6885 6934 39A1 CD2C

To claim this, I am signing this object:

@blake41
blake41 / html
Last active August 29, 2015 14:21
.hidden {
visibility: hidden;
}
require 'pry'
require 'pry-nav'
array = ["1-28-2015 NYC LPEP $20.16",
"1-29-2015 DEN $17.06",
"1-30-2015 Aden Food Market $11.89",
"1-30-2015 ZIZI LIMONA $96.65",
"1-31-2015 FOODTOWN $67.49",
"2-4-2015 NYC-TAXI $15.96",
"2-4-2015 DRAM $21.00",
"2-4-2015 BALTHAZAR $42.40",
relationships = []
File.foreach("./input.txt") do |line|
items = line.split(" ")
relationships << [items[6], items[7]]
end
connections = Hash.new {|k, v| k[v] = []}
relationships.each do |pair|
connections[pair[0]] << pair[1]
end
Function.prototype.bind = function(that) {
var args = Array.prototype.slice.call(arguments)
return function() {
this.call(that, args)
}
}
var myobj = {
name : "blake",