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
# Package libssl was not found in the pkg-config search path. | |
# Perhaps you should add the directory containing `libssl.pc' | |
# to the PKG_CONFIG_PATH environment variable | |
# No package 'libssl' found | |
# Package libcrypto was not found in the pkg-config search path. | |
# Perhaps you should add the directory containing `libcrypto.pc' | |
# to the PKG_CONFIG_PATH environment variable | |
# No package 'libcrypto' found | |
export PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig |
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
mkdir ~/java10 | |
cd ~/java10 | |
wget --no-cookies --no-check-certificate --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/10+46/76eac37278c24557a3c4199677f19b62/jdk-10_linux-x64_bin.tar.gz | |
tar -zxvf jdk-10_linux-x64_bin.tar.gz | |
cd jdk-10/ | |
update-alternatives --install /usr/bin/java java ~/java10/jdk-10/bin/java 100 | |
update-alternatives --config java | |
update-alternatives --install /usr/bin/javac javac ~/java10/jdk-10/bin/java 100 | |
update-alternatives --config javac | |
update-alternatives --install /usr/bin/jar jar ~/java10/jdk-10/bin/jar 100 |
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
def print_memory_usage | |
memory_before = `ps -o rss= -p #{Process.pid}`.to_i | |
yield | |
memory_after = `ps -o rss= -p #{Process.pid}`.to_i | |
puts "Memory: #{((memory_after - memory_before) / 1024.0).round(2)} MB" | |
end | |
def print_time_spent | |
time = Benchmark.realtime do |
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
cd ~ | |
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
brew analytics off | |
brew doctor | |
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" | |
\curl -sSL https://get.rvm.io | bash -s stable | |
source /Users/edgarortega/.rvm/scripts/rvm | |
type rvm | head -1 | |
rvm -v | |
brew install git node vim postgres tmux yarn ag |
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 'openssl' | |
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE |
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
def gen(nums, digit) | |
result = [] | |
nums.each_with_index do |num, i| | |
slice = nums[i, digit] | |
tmp = slice.concat(nums[i + digit]) | |
result.push(tmp) | |
end | |
result | |
end | |
gen([0,1,2],1) |
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
brew update && brew upgrade --all && brew cleanup && brew prune |
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 CreateRelations < ActiveRecord::Migration | |
def change | |
create_table :relations do |t| | |
t.references :user, index: true, foreign_key: true | |
t.integer :friend_id, index: true | |
t.timestamps null: false | |
end | |
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
# Hides Draper decorator inside the model and lazily decorates resources | |
# | |
# https://gist.github.com/firedev/7a82059b30a2157d4c56 | |
# | |
# model.rb: | |
# include Decorated | |
# | |
# Just make sure there are no overlapping method names in ModelDecorator | |
module Decorated |
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
# config/routes.rb | |
resources :documents do | |
resources :versions, controller: "documents/versions" do | |
post :restore, on: :member | |
end | |
resource :lock, controller: "documents/locks" | |
end | |