Josh Cheek JoshCheek

View explanation-of-easter.md

For those of you who were confused about why all the Christians you knew were in a tizzy yesterday, it's not because they were celebrating April 20, rather they were celebrating a Christian holiday known as Easter. Allow me to explain:

Christians believe there is an entity known as "god". It's not clear what makes this entity special, some think it created everything (though it's unclear what created the entity). Some think it is the most powerful entity that exists, and that gives it special rights, like the right to determine what is morally permissible. This belief is important to Easter, as you'll see below. Also, god is a boy, even though it is usually considered noncorporeal (no chromosomes, no penis), so we will refer to it as a he from now on.

God made you perfectly, with full knowledge of everything you would do. For some reason, you don't live up to his standards, though. Not living up to his standard is called a "sin". Because of your sin

View testing_a_client_for_a_backend_app.rb
1 2 3 4 5 6 7 8
# backend app
require 'sinatra/base'
require 'json'
class UsersController < Sinatra::Base
get '/users/:id' do
JSON.dump id: params[:id].to_i, name: "Josh"
end
end
View example.js
1 2 3 4 5 6 7 8 9 10
function markRowHidden(dataAttribute) {
return function() {
var tr = $(this).closest('tr');
tr.data(dataAttribute, true);
tr.hide();
}
}
 
$("tr form.type1").on("submit", markRowHidden("attribute1"));
$("tr form.type2").on("submit", markRowHidden("attribute2"));
View day2.txt
1 2 3 4 5 6 7 8 9 10
The roster is in the back, sign in or we'll have to hunt you down!
 
implement scaffold
guides at guides.rubyonrails.org
docs at api.rubyonrails.org
new rails project
looking around ($ rails server)
generate the scaffold (articles with a title, body, and timestamps)
show how it works
go over the request to response flow
View whatevzs
1 2 3 4 5 6 7 8 9 10
Setup Mac
- Make sure you have xcode
- Install homebrew (bottom of http://brew.sh)
password: bbuser
- $ brew install git rbenv ruby-build
$ echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
new terminal window
$ rbenv install 2.1.1
$ rbenv global 2.1.1
$ ruby -v
View Invoice.total_outstanding.spec.rb
1 2 3 4 5 6 7 8 9 10
require 'active_record'
 
ActiveRecord::Base.establish_connection adapter: 'sqlite3', database: ':memory:'
 
ActiveRecord::Schema.define do
self.verbose = false
create_table(:invoices) { |t| t.float :amount }
end
 
class Invoice < ActiveRecord::Base
View le_sigh.rb
1 2 3 4 5 6 7
require 'factory_girl' # => true
FactoryGirl::VERSION # => "4.4.0"
 
what_the_fuck_is_self = nil # => nil
FactoryGirl.define do factory(:qhatev) { what_the_fuck_is_self = self } end # => []
 
what_the_fuck_is_self.class # => #<FactoryGirl::Declaration::Implicit:0x007fa19bb8c6a0 @name=:class, @ignored=false, @factory=#<FactoryGirl::Definition:0x007fa19bb8da28 @declarations=#<FactoryGirl::DeclarationList:0x007fa19bb8d9d8 @declarations=[#<FactoryGirl::Declaration::Implicit:0x007fa19bb8c6a0 ...>], @name=:qhatev, @overridable=false>, @callbacks=[], @defined_traits=#<Set: {}>, @to_create=nil, @base_traits=[], @additional_traits=[], @constructor=nil, @attributes=nil, @compiled=false>>
View ascii-avatar.txt
1 2 3 4 5 6 7 8 9 10
 
,.....,,::~~~~~=?II77$$Z$$ZZZ$$77I7?III???????????II??IIII?IIIIIIII77I7I77777777
,...,,.,~:::~~~~=++???I777$$$$Z$$I7I?I????+????I?I???I?I?IIII7777$77$Z$$$Z$$Z$ZZ
.....,,,:::::~==+=++?I??II777IIII7IIII?????+???I?IIIIIIIIII7II7$7$ZZZ$ZZOOOOOOZO
....,,,,:~::::~===+=++++??I77I777II??I???+++++???III?IIIIII77I$$ZZZOZZOZOO88OZOZ
....,,,:~~~~::~~=~=++++++?IIII777777I??+++==++???II?III7II777777$ZZ$$$$$$$77$Z77
,....,,:~~=~:=~~~==++???IIIIII777777$$I?+++++++??+??IIII7777$$$ZZ$$Z$$7$7$$7777$
,....,:~~~=+=~==~+++?????+?II777$$$Z777I?+++++=?++??II77$$$$ZOZZ$$Z$ZZ777777777$
:....,:~==++++??+==+++++?I777$$$$OOZ7777I++=+++++??III77$ZZZOZZZ$$$$$7777I7IIII7
~.....,:~==++===I77$Z$7Z$$ZZOO888ZZ$$7I7I??=====+??II77$$ZOZOZOOOZZZ$$7II7777777
View 1_with_nested_methods.rb
1 2 3 4 5 6 7 8 9 10
# hypothetical implementation of nested methods
module Tetris
extend self
def add_block(board, block_definition, x, y=nil)
block_height = block_definition.height_for_rotation(0)
y ||= board.height + block_height
is_within_board_width!
is_not_below_board!
View i_dont_understand_random.rb
1 2 3 4 5 6 7 8 9
class RandomCollectionQueue
def initialize(seed, collection)
random = ::Random.new seed
self.collection = collection
self.seed = seed
self.next_seed = random.rand
self.block_index = random.rand collection.size
p [seed, next_seed]
end
Something went wrong with that request. Please try again.