Skip to content

Instantly share code, notes, and snippets.

View randallb's full-sized avatar
🎬

Randall Bennett randallb

🎬
View GitHub Profile
@randallb
randallb / gist:8154300
Created December 28, 2013 00:02
Emmett originally wrote this post but I couldn't find anywhere except on archive.org. So I mirrored.

As I've done more code reviews at Justin.tv, I've started to notice a pattern. When I get a diff and I have trouble keeping focused because it's just that boring, this is a sign that the code is pretty much ready to go into production. This isn't to say that the code should be repetitive; repetitive code is not boring. I imagine it might be boring if I read it, but the instant I see the same pattern more than once in the code I just make a note to refactor it and move on. So a really repetitive code review actually is one of the more interesting ones to read - if you don't find noticing repeated patterns in code fun you're probably not a programmer. A really boring code review has very little obvious repetition.

Another thing that often makes a code review interesting is implementing a new generic abstraction. Personally, I love generic abstractions. New kinds of iterators are a particular favorite of mine, because they allow you to so cleanly separate what you do to each item from how you find each one.

<script>
jQuery().ready(function{
width = jQuery(window).width()
if(width > 768){
jQuery(".big-ad").show();
// init code for the big ad
}else{
jQuery(".small-ad").show()
// init code for the small ad
}
{"author_handle":"maryju333","author_image":"http://si0.twimg.com/profile_images/3611908649/888dc6ffc60510e36b758e0ff688cdea.jpeg","author_name":"MARIA JULIA ","author_service_id":209315366,"channel_id":null,"created_at":null,"id":null,"image":null,"likes":null,"message":"@Frec_Latina #ALAIRE #90FL El sistema d Albergues NO funciona hay abuso entre ninhos abandonados Kerk estara Protegido con Tios o parientes","org_id":null,"playlist_id":null,"position":null,"post_id":null,"posted_at":"2013-09-17T13:32:19-06:00","retweets":0,"service_data":{"metadata":{"result_type":"recent","iso_language_code":"es"},"created_at":"Tue Sep 17 19:32:19 +0000 2013","id":380051608672808960,"id_str":"380051608672808960","text":"@Frec_Latina #ALAIRE #90FL El sistema d Albergues NO funciona hay abuso entre ninhos abandonados Kerk estara Protegido con Tios o parientes","source":"<a href=\"http://blackberry.com/twitter\" rel=\"nofollow\">Twitter for BlackBerry\u00ae</a>","truncated":false,"in_reply_to_status_id":380014331938619392,"in
{"created_at":"2013-08-19T12:12:41-06:00","id":4778,"live":false,"name":"Back to school pics","org_id":31,"slug":"back-to-school-pics","updated_at":"2013-08-19T12:12:41-06:00","user_id":null,"entries":[{"author_handle":null,"author_image":"http://graph.facebook.com/100004235194478/picture?type=large","author_name":"Sabrina Ross Barrios","channel_id":null,"created_at":"2013-08-19T12:13:13-06:00","id":173101,"image":"http://sphotos-b.xx.fbcdn.net/hphotos-prn2/q75/s480x480/1175726_225027790981726_1044342005_n.jpg","likes":2,"message":"Nathans 1st day in 1st grade love you have a great day","org_id":31,"playlist_id":4778,"position":1,"post_id":null,"posted_at":"2013-08-19T10:09:21-06:00","retweets":null,"service_data":{"created_time":"2013-08-19T16:09:21+0000","from":{"name":"Sabrina Ross Barrios","id":"100004235194478"},"message":"Nathans 1st day in 1st grade love you have a great day","likes":{"data":[{"category":"Tv channel","category_list":[{"id":"169056916473899","name":"Broadcasting & Media Production"}],"n
describe 'relativeDate', ->
beforeEach module 'relativeDate'
it 'should return `just now` if the date is within the last minute', inject (relativeDate) ->
referenceDate = new Date
console.log referenceDate
expect(relativeDate(referenceDate)).toBe("just now")
it 'should return `a minute ago` if the date is older than 7/10ths of a minute but less than 1.5 minutes'
it 'should return `x minutes ago` if the date is older than 1.5 minutes but less than 55 minutes'
traceroute to 198.58.104.178 (198.58.104.178), 64 hops max, 52 byte packets
1 192.168.1.1 (192.168.1.1) 3.709 ms 0.814 ms 0.788 ms
2 73.90.52.1 (73.90.52.1) 8.805 ms
te-0-0-0-4-ur10.beaverton.or.bverton.comcast.net (68.85.148.217) 9.561 ms 8.515 ms
3 ae-3-0-ar03.troutdale.or.bverton.comcast.net (68.85.243.165) 9.016 ms 10.259 ms 10.287 ms
4 68.86.95.89 (68.86.95.89) 16.794 ms
pos-2-4-0-0-cr01.seattle.wa.ibone.comcast.net (68.86.91.197) 18.093 ms
68.86.95.89 (68.86.95.89) 15.624 ms
5 be-16-pe03.seattle.wa.ibone.comcast.net (68.86.83.10) 13.838 ms 15.868 ms 14.043 ms
6 ae13.bbr01.wb01.sea02.networklayer.com (75.149.228.38) 13.208 ms 14.446 ms 13.963 ms

What's your name?

Email address?

What's your story? (Tell us what you'd tell someone at a party if they asked about you.)

Why do you want to learn to code?

Do you have an app idea already? (Not required, just curious what you're interested in.)

undefined method `[]' for nil:NilClass
twitter (4.7.0) lib/twitter/client.rb:97:in `block in request_setup'
sc = new RC.shortcut;
sc.queue(function(chain){
chain.take()
chain.load()
chain.dothing()
})
// chain just adds that to a queue, and when the fn returns, you execute the queue in order.
respond_to do |format|
format.html {render :angular, layout: 'output'}
format.json {render :xhr, layout: false}
end