This file contains 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
brew uninstall readline | |
cd /usr/local/ | |
git checkout 0181c8a Library/Formula/readline.rb | |
brew install readline | |
RUBY_CONFIGURE_OPTS="--with-readline-dir=$(brew --prefix readline) --with-openssl-dir=$(brew --prefix openssl)" ruby-install ruby |
This file contains 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
gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.3/bin/pg_config |
This file contains 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
begin | |
require 'awesome_print' | |
AwesomePrint.pry! | |
rescue | |
puts 'There is no Awesome Print gem installed' | |
end |
This file contains 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
# | |
# Wide-open CORS config for nginx | |
# | |
location / { | |
if ($request_method = 'OPTIONS') { | |
add_header 'Access-Control-Allow-Origin' '*'; | |
# |
This file contains 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 'crxmake' | |
require 'digest/sha2' | |
# generate id from pem | |
def generate_id pkey | |
key = CrxMake::KEY + pkey.public_key.to_der | |
id = Digest::SHA256.hexdigest(key) | |
id[0..32].split('').map{|ch| ('a'.ord + ch.hex).chr }.join('') | |
end |
This file contains 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
# lib/stop_words.rb: | |
module StopWords | |
def stop_words_finder | |
stop_words = ["ich", "heute"] | |
end | |
end | |
# models/pool.rb: |
This file contains 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
module Tire | |
module Disable | |
module ClassMethods | |
def mock_es_response_doc | |
@mock_es_response_doc ||= | |
'{"took": 1,"timed_out": false,"_shards": {"total": 5,"successful": 5,"failed": 0},"hits": {"total": 0,"max_score": null,"hits": []}}' | |
end | |
def enable! &blk | |
old_enabled = @tire_enabled || false |
This file contains 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
def generate(n) | |
return [] if n == 1 | |
factor = (2..n).find { |x| n % x == 0 } | |
[factor] + generate(n / factor) | |
end |
This file contains 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
#!/usr/bin/tclsh8.5 | |
# | |
# Install: clone and copy to somewhere in your $PATH, e.g: | |
# git clone https://gist.github.com/4681074.git git-unmerged && cd git-unmerged && chmod +x git-unmerged && sudo mv git-unmerged /usr/bin && cd .. && rm -rf git-unmerged | |
# Usage: git-unmerged branch1 branch2 | |
# | |
# Shows all the non-common commits in the two branches, where non-common | |
# commits means simply commits with a unique commit *message*. | |
proc getlog branch { |
This file contains 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
# usage: | |
# FRUITS = Enum.new(:apples, :oranges) | |
# FRUITS[:apples] # => 0 | |
# FRUITS[0] # => :apples | |
class Enum < Hash | |
def initialize(*members) | |
super() | |
@reverse = {} |
OlderNewer