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
| #!/bin/bash | |
| if [[ $# -lt 1 ]]; then | |
| echo "Usage: $0 somedir/*.jpg" | |
| exit 1 | |
| fi | |
| files=($*) | |
| let "i = $RANDOM % ${#files[*]}" | |
| pick=${files[$i]} | |
| echo "Draw: $pick" | |
| open $pick |
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
| {"lastUpload":"2020-10-18T15:48:53.735Z","extensionVersion":"v3.4.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
| if Gem::Specification.find_all_by_name("clipboard", "~> 1.0").any? | |
| gem "clipboard", "~> 1.0" | |
| require "clipboard" | |
| # ... | |
| 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
| class Symbol | |
| def call(*curry_args) | |
| ->(receiver, *args) { | |
| receiver.public_send(self, *curry_args, *args) | |
| } | |
| end | |
| end | |
| data = [{'x'=>1}, {'x'=>2},{'x'=>'foo'}] |
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
| class Array | |
| def to_proc | |
| ->(receiver, *args) { | |
| receiver.public_send(*self, *args) | |
| } | |
| end | |
| end | |
| data = [{'x'=>1}, {'x'=>2},{'x'=>'foo'}] |
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
| require "delegate" | |
| class BankAccount | |
| def number | |
| 123456 | |
| end | |
| end | |
| class SimpleDelegatorBankAccount < SimpleDelegator | |
| 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
| RUBY_VERSION # => "2.1.5" | |
| m = define_method %^ | |
| puts "The coding standard says 'long methods are bad'." | |
| puts "Stupid coding standards. What do they know?" | |
| puts "It says long method names are OK though." | |
| puts "Suckers!" | |
| ^ do | |
| eval(__callee__.to_s) | |
| 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
| import Sony.Vegas; | |
| var one_second = Timecode.FromMilliseconds(1000); | |
| var transport = Vegas.Transport; | |
| var start = transport.LoopRegionStart; | |
| var length = transport.LoopRegionLength; | |
| transport.LoopRegionLength = length + one_second + one_second; | |
| transport.LoopRegionStart = start - one_second; |
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
| e = loop | |
| e # => #<Enumerator: main:loop> | |
| e.next # => nil | |
| e.next # => nil | |
| e.peek # => nil | |
| e.size # => Infinity | |
| e.rewind | |
| e.next # => nil |
NewerOlder