An implementation of Conway's Game of Life in 140 characters of Ruby.
Created by Simon Ernst (@sier).
An implementation of Conway's Game of Life in 140 characters of Ruby.
Created by Simon Ernst (@sier).
| /** | |
| * supplant() does variable substitution on the string. It scans through the string looking for | |
| * expressions enclosed in { } braces. If an expression is found, use it as a key on the object, | |
| * and if the key has a string value or number value, it is substituted for the bracket expression | |
| * and it repeats. | |
| * | |
| * Written by Douglas Crockford | |
| * http://www.crockford.com/ | |
| */ | |
| String.prototype.supplant = function (o) { |
| ⨀_⨀ | |
| ⨂_⨂ | |
| (/◔ ◡ ◔)/ | |
| °ﺑ° | |
| (¬_¬) | |
| (´・ω・`) | |
| (ʘ_ʘ) | |
| (ʘ‿ʘ) | |
| (๏̯͡๏ ) | |
| (◕_◕) |
| require 'openssl' | |
| class String | |
| def encrypt(key) | |
| cipher = OpenSSL::Cipher::Cipher.new('DES-EDE3-CBC').encrypt | |
| cipher.key = Digest::SHA1.hexdigest key | |
| s = cipher.update(self) + cipher.final | |
| s.unpack('H*')[0].upcase | |
| end |
| #config/initializers/carrierwave.rb | |
| module CarrierWave | |
| module MiniMagick | |
| # Rotates the image based on the EXIF Orientation | |
| def exif_rotation | |
| manipulate! do |img| | |
| img.auto_orient | |
| img = yield(img) if block_given? | |
| img | |
| end |
| # This is a skeleton for testing models including examples of validations, callbacks, | |
| # scopes, instance & class methods, associations, and more. | |
| # Pick and choose what you want, as all models don't NEED to be tested at this depth. | |
| # | |
| # I'm always eager to hear new tips & suggestions as I'm still new to testing, | |
| # so if you have any, please share! | |
| # | |
| # @kyletcarlson | |
| # | |
| # This skeleton also assumes you're using the following gems: |