Skip to content

Instantly share code, notes, and snippets.

View chhhris's full-sized avatar
🚁
Working From Helicopter

Christopher Lake chhhris

🚁
Working From Helicopter
View GitHub Profile
# Create Hashes for the following use-cases.
# A movie collection that organizes by genres
movies {
:genre1 => ["movie title 1", "movie title 2", "movie title 3"],
:genre2 => ["movie title 1", "movie title 2", "movie title 3"],
:genre3 => ["movie title 1", "movie title 2", "movie title 3"],
}
}
@chhhris
chhhris / mind_games_poem.txt
Last active March 15, 2019 21:51
"Mind Games" Outline
Foreward


"If it sounds to you like everything that could go wrong is going wrong, then I would have to agree.
"Do you know what it is? What’s causing all this misery and suffering?
"I know now, but for a long time, I had no idea why my luck had turned. Why my deepest and darkest fears had manifested themselves into real life.
"For a long time, I thought I was alone. Of course by now, I know I am not alone. And other people who thought they were alone, now realize the truth as well.
@chhhris
chhhris / api_calls.md
Last active January 5, 2018 20:24
Skyscanner flight price discrepancy
# ruby
params = {
  :country=>"US", 
  :currency=>"USD", 
  :locale=>"en-US", 
  :locationSchema=>"iata", 
  :apikey=>"ve518156965014636303894819187830", 
  :originplace=>"JFK-sky", 
 :adults=>1, 
@chhhris
chhhris / find_file.sh
Created June 2, 2016 17:41
Bash script for searching directory with list of file names passed as array
declare -a array=("add-student.png" "assessment-progressbar.png" "blank.gif" "browse.png" "cert-altiusEd.png" "cert-p-completion.png" "cert-p-grat.gif" "cert-p-l.gif""cert-p-r.gif" "cert-signature-b.png" "ckeditor-helix-icons.png" "completion-badge-print.png" "crop.png" "dialog-close.png" "fb-share.png""helix-fb-share-cert.png" "ibc-logo-4c.png" "logo_footer.png" "logo_img.png" "logo_text.png" "online-status.png" "remove-18.png" "share-board.png""sprite-40plus.png" "sprites.png" "stack-large.png" "stack-medium.png" "stack-small.png" "start-date.png" "test/announce.png" "texture.png""ui-bg_flat_0_878787_40x100.png" "ui-bg_flat_0_aaaaaa_40x100.png" "ui-bg_flat_75_ffffff_40x100.png" "ui-bg_glass_55_fbf9ee_1x400.png""ui-bg_glass_65_ffffff_1x400.png" "ui-bg_glass_75_bcdbf0_1x400.png" "ui-bg_glass_75_dadada_1x400.png" "ui-bg_highlight-soft_75_dbdbdb_1x100.png""ui-bg_highlight-soft_95_fad3d1_1x100.png" "ui-icons_222222_256x240.png" "ui-icons_333333_256x240.png" "ui-icons_454545_256x240.png""ui-icons_4f4f4f_256x240.p
@chhhris
chhhris / live-emails-dev-mode.rb
Last active January 4, 2016 20:49
Sending live emails in development mode
# now with Mandrill
# with SENDGRID
# sending emails to your email while in development mode.
# mail_interceptor.rb
if Rails.env.development?
message.to = 'your@email.com'
// iOS Media Queries
// Goal: capture styles for iPhone, iPhone 3G, iPhone 3GS, iPhone 4, iPhone 4S, iPad, and iPad 2
//
// Author: Tony Schneider (@tonywok)
// Please tell me where I fail. :)
// iPhone v(4,4S) portrait
// test: black text (overwritten by v* portrait) with blue background
@media all and (-webkit-min-device-pixel-ratio: 2) and (orientation: portrait) {
a {

What is a closure?

How do we implement/create/use a closure in Ruby?

What's the difference between a closure in JS vs Ruby?

Why do we use closures so much more in JS as opposed to Ruby?

What is the Ruby analog of an anonymous function in Javascript?

require 'fis/test'
class Phone
def initialize(number)
@number = number.gsub(/\D/, '')
if @number.length == 11 && @number[0] == "1"
@number = @number[1..10]
end
end
class MyApp
def call(env)
[200, {'Content-Type' => 'text/html'}, ['<a style="background-color:red;">URGENT MSG</a> from Tiny Tim: Hello']]
end
end