This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| irb(main):001:0> require 'benchmark' | |
| => true | |
| irb(main):002:0> puts Benchmark.measure { system "xclip .bashrc" } | |
| 0.000000 0.000000 0.000000 ( 0.008030) | |
| => nil | |
| irb(main):003:0> puts Benchmark.measure { `xclip .bashrc` } | |
| 0.000000 0.000000 0.000000 ( 33.215158) | |
| => nil | |
| irb(main):004:0> RUBY_VERSION | |
| => "2.0.0" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| RSpec.configure do |config| | |
| config.use_transactional_fixtures = false | |
| config.before(:suite) do | |
| DatabaseCleaner.clean_with(:truncation) | |
| end | |
| config.before(:each) do | |
| DatabaseCleaner.strategy = :transaction | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Rails::Rack::Logger.class_eval do | |
| def call_with_quiet_assets(env) | |
| previous_level = Rails.logger.level | |
| Rails.logger.level = Logger::ERROR if env['PATH_INFO'].index("/assets/") == 0 | |
| call_without_quiet_assets(env).tap do | |
| Rails.logger.level = previous_level | |
| end | |
| end | |
| alias_method_chain :call, :quiet_assets | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .topic__node { | |
| @extend .ui.red.label; | |
| @extend .zeta; | |
| position: relative; | |
| left: 1.55rem; | |
| float: right; | |
| margin: 0.2rem 0; | |
| padding: 0 1em 0.1em 0.8em; | |
| border-color: rgba(0, 0, 0, 0.15); | |
| border-radius: 4px 0px 0px 4px; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| <plist version="1.0"> | |
| <dict> | |
| <key>KeepAlive</key> | |
| <true/> | |
| <key>Label</key> | |
| <string>org.shadowsocks</string> | |
| <key>ProgramArguments</key> | |
| <array> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; Exercise 1.1 | |
| 10 ;Value: 10 | |
| (+ 5 3 4) ;Value: 12 | |
| (- 9 1) ;Value: 8 | |
| (/ 6 2) ;Value: 3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @@foo = 'foo' | |
| Object.class_variable_get(:@@foo) # => "foo" | |
| class Bar | |
| def self.foo | |
| @@foo | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (define (lat? l) | |
| (cond ((null? l) #t) | |
| ((atom? (car l)) (lat? (cdr l))) | |
| (else #f))) | |
| (define (member? a lat) | |
| (cond ((null? lat) #f) | |
| ((eq? a (car lat)) #t) | |
| (else (member? a (cdr lat))))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (define (sum-int a b) | |
| (if (> a b) | |
| 0 | |
| (+ a | |
| (sum-int (1+ a) b)))) | |
| (define (sum-sq a b) | |
| (if (> a b) | |
| 0 | |
| (+ (square a) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (define (sqrt x) | |
| (define tolerance 0.00001) | |
| (define (good-enough? y) | |
| (< (abs (- (square y) x)) | |
| tolerance)) | |
| (define (improve y) | |
| (average (/ x y) y)) | |
| (define (try y) | |
| (if (good-enough? y) | |
| y |