- Use less for paging, but still provide ack's nice colored output and per-file grouping, by adding this to .ackrc:
--pager=less -r -E
- inheritance patterns: prototypal/classical/pseudo-classical/hacked-classical/functional
- class frameworks:
| /** | |
| * Cross-browser logging utils | |
| * | |
| * This fn differs from something like the jQuery log plugin in that | |
| * it returns console.log, if avail, instead of calling it. This allows | |
| * us to call it in file with the log statement, which means that the | |
| * line # and file name displayed are more helpful. This isn't supposed | |
| * to be a logging framework like blackbird or log4javascript. | |
| * | |
| * Usage: var msg = 'foo'; log(msg).call(console, msg) |
| # .... | |
| get '/start' do | |
| consumer = OAuth::Consumer.new( ENV['OAUTH_KEY'], ENV['OAUTH_SECRET'], { | |
| :site => "https://api.twitter.com", | |
| :request_token_path => '/oauth/request_token' | |
| }) | |
| request_token = consumer.get_request_token({:oauth_callback => ENV['OAUTH_CALLBACK']}) | |
| response.set_cookie( "oauth_request_token", request_token.params['oauth_token_secret'] ) | |
| redirect request_token.authorize_url | |
| end |
| // I'm not sure what this is supposed to be demonstrating, | |
| // but I think it's worth noting that flashyBlueBtn contains | |
| // color & effect attributes event though we say | |
| // FlashyBlueButton.prototype = blueBtn. | |
| function Button(color){ | |
| this.color = color; | |
| } | |
| var blueBtn = new Button('blue'); |
| // Credit: http://javascript.crockford.com/prototypal.html | |
| if (typeof Object.create !== 'function') { | |
| Object.create = function (o) { | |
| function F() {} | |
| F.prototype = o; | |
| return new F(); | |
| }; | |
| } | |
| newObject = Object.create(oldObje |
| require 'router' | |
| use Rack::CommonLogger | |
| use Rack::ShowExceptions | |
| use Rack::Lint | |
| use Rack::Static, :urls => ["/static"] | |
| run Router.new |
| " use 4-space soft tabs | |
| " http://vim.wikia.com/wiki/Indenting_source_code | |
| set expandtab | |
| set shiftwidth=4 | |
| set softtabstop=4 | |
| " turn on auto-indent | |
| " Note: to auto-indent a whole file, run: gg=G | |
| set autoindent |
| # Watchr script used in http://erikeldridge.wordpress.com/2010/12/13/running-yeti-tests-automatically-with-watchr/ | |
| # watch for changes in test files | |
| watch( 'test/test_.*\.html' ) { |md| | |
| system('clear'); | |
| system("yeti #{md[0]}") | |
| } | |
| # watch for changes in lib files | |
| watch( 'lib/(.*)\.js' ) { |md| | |
| system('clear'); |
| GitHub.TreeSlider = function () { | |
| if (window.history && window.history.pushState) { | |
| function a() { | |
| if (e.sliding) { | |
| e.sliding = false; | |
| $(".frame-right").hide(); | |
| $(".frame-loading:visible").removeClass("frame-loading") | |
| } | |
| } | |
| if (!($("#slider").length == 0 || !GitHub.shouldSlide)) if (!navigator.userAgent.match(/(iPod|iPhone|iPad)/)) { |
| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" | |
| "http://www.w3.org/TR/html4/strict.dtd"> | |
| <html> | |
| <head> | |
| <!-- Licensed under Yahoo! BSD license http://gist.github.com/375593 --> | |
| </head> | |
| <body> | |
| <span id="login"></span> | |