create different ssh key according the article Mac Set-Up Git
$ ssh-keygen -t rsa -C "[email protected]"
| require 'feedzirra' | |
| # fetching a single feed | |
| feed = Feedzirra::Feed.fetch_and_parse("http://feeds.feedburner.com/PaulDixExplainsNothing") | |
| # feed and entries accessors | |
| feed.title # => "Paul Dix Explains Nothing" | |
| feed.url # => "http://www.pauldix.net" | |
| feed.feed_url # => "http://feeds.feedburner.com/PaulDixExplainsNothing" | |
| feed.etag # => "GunxqnEP4NeYhrqq9TyVKTuDnh0" |
create different ssh key according the article Mac Set-Up Git
$ ssh-keygen -t rsa -C "[email protected]"
| require 'io/console' | |
| # Reads keypresses from the user including 2 and 3 escape character sequences. | |
| def read_char | |
| STDIN.echo = false | |
| STDIN.raw! | |
| input = STDIN.getc.chr | |
| if input == "\e" then | |
| input << STDIN.read_nonblock(3) rescue nil |
This was my solution for a polymorphic many-to-many association
class ItemCountry < ActiveRecord::Base
belongs_to :locatable, :polymorphic => true
belongs_to :country
# fields are :locatable_id, :locatable_type, :country_id
end
class Title < ActiveRecord::Base
has_many :countries, :through => :item_countries, :as => :locatable
| // Determine if an element is in the visible viewport | |
| function isInViewport(element) { | |
| var rect = element.getBoundingClientRect(); | |
| var html = document.documentElement; | |
| return ( | |
| rect.top >= 0 && | |
| rect.left >= 0 && | |
| rect.bottom <= (window.innerHeight || html.clientHeight) && | |
| rect.right <= (window.innerWidth || html.clientWidth) | |
| ); |
| # config/routes.rb | |
| resources :documents do | |
| scope module: 'documents' do | |
| resources :versions do | |
| post :restore, on: :member | |
| end | |
| resource :lock | |
| end | |
| end |
| Plugboard = Hash[*('A'..'Z').to_a.sample(20)] | |
| Plugboard.merge!(Plugboard.invert) | |
| Plugboard.default_proc = proc { |_, key| key } | |
| def build_a_rotor | |
| Hash[('A'..'Z').zip(('A'..'Z').to_a.shuffle)] | |
| end | |
| ROTOR_1, ROTOR_2, ROTOR_3 = build_a_rotor, build_a_rotor, build_a_rotor |
| function gcme(){ | |
| message=$1 | |
| message_with_emoji=$message | |
| if [[ $message == *"add"* ]] | |
| then | |
| message_with_emoji="$1 :beer:" | |
| elif [[ $message == *"remove"* ]] | |
| then | |
| message_with_emoji="$1 :mask:" | |
| elif [[ $message == *"fix"* ]] |
Options included below:
docker-composebrewThis gist was originally created for Homebrew before the rise of Docker, yet it may be best to avoid installing mysql via brew any longer. Instead consider adding a barebones docker-compose.yml for each project and run docker-compose up to start each project's mysql service.