email = "[email protected]"
user = User.find_by(email: email)
account = user.account
team = account.team
| $ brew update | |
| $ brew boxen-install gnupg | |
| $ gpg --gen-key # Use the same email address as github, local gitconfig, and SSH key | |
| $ gpg --list-secret-keys --keyid-format LONG # Take everything after the / in pub to use in the following command | |
| $ git config --global user.signingkey <YOUR KEY HASH HERE i.e. 0A123456> | |
| $ git config --global commit.gpgsign true | |
| $ gpg --armor --export <YOUR_EMAIL_ADDRESS_HERE> | pbcopy | |
| $ open https://github.com/settings/keys # Paste the key into GPG keys here |
email = "[email protected]"
user = User.find_by(email: email)
account = user.account
team = account.team
| # Setup your merge tool | |
| $ git config --global merge.tool opendiff | |
| # Use your merge tool when you have conflicts | |
| $ git mergetool | |
| # Cleanup after your merge (delete .orig files) | |
| $ find . -name "*.orig" -delete |
| rubocop_happy = $(rubocop -a) | |
| if [ "$rubocop_happy" != "true" ] | |
| then | |
| cat <<\EOF | |
| Error: Rubocop detected style conflicts, commit cancelled, please review. | |
| EOF | |
| exit 1 | |
| fi |
| pg_dump --create --column-inserts melody_development > melody_development_dump.sql # or whatever your database is called | |
| # edit dump.sql and change the column order | |
| # stop webserver | |
| be rake db:drop | |
| be rake db:create | |
| psql -f melody_development_dump.sql melody_development | |
| be rake db:migrate | |
| be rake db:test:prepare |
| require 'octokit' | |
| ACCESS_TOKEN = "" # Create at https://github.com/settings/tokens | |
| ORGANIZATION_NAME = "SalesLoft" | |
| USER_NAME = "thephw" | |
| PULL_REQUEST_OPTIONS = {state: :all, head: USER_NAME, sort: :created, direction: :desc} | |
| FILTER_AFTER = Time.parse('2015-05-18 00:00:00 UTC') | |
| client = Octokit::Client.new(access_token: ACCESS_TOKEN) | |
| repositories = client.repositories.map(&:full_name).select{|repo| repo.start_with?(ORGANIZATION_NAME)} |
| # Edit this file to introduce tasks to be run by cron. | |
| # | |
| # Each task to run has to be defined through a single line | |
| # indicating with different fields when the task will be run | |
| # and what command to run for the task | |
| # | |
| # To define the time you can provide concrete values for | |
| # minute (m), hour (h), day of month (dom), month (mon), | |
| # and day of week (dow) or use '*' in these fields (for 'any').# | |
| # Notice that tasks will be started based on the cron's system |
| ul{ | |
| list-style-type:none; | |
| counter-reset: section; | |
| } | |
| li:before { | |
| counter-increment: section; | |
| content: counter(section); | |
| } | |
| li:nth-child(3n):before, li:nth-child(5n):before{ | |
| content: ""; |
| class IntList | |
| attr_accessor :value, :next | |
| end | |
| def get_length(l) | |
| return 0 if l.nil? | |
| len = 1 + get_length(l.next) | |
| end |
| def min_abs_slice_sum(a) | |
| a.each_index.to_a.combination(2).map{|i,j| a[(i..j)].inject(&:+).abs}.min | |
| end | |
| def run_benchmark | |
| require 'benchmark' | |
| n = 3 | |
| Benchmark.bm(17) do |x| | |
| (0..n).each do |i| |