Skip to content

Instantly share code, notes, and snippets.

Avatar
👯‍♀️
OMG

Ian Vaughan IanVaughan

👯‍♀️
OMG
View GitHub Profile
@grodowski
grodowski / merge_coverage.rb
Last active Apr 24, 2020
Merge coverage reports from parallel circle test containers
View merge_coverage.rb
#!/usr/bin/env ruby
# frozen_string_literal: true
require 'simplecov'
require 'simplecov-lcov'
puts('Merging coverage results from parallel CircleCI tests containers into a single LCOV report...')
results = []
Dir['/home/circleci/rspec/*.resultset.json'].each do |path|
@joyrexus
joyrexus / README.md
Last active May 11, 2021
collapsible markdown
View README.md

collapsible markdown?

CLICK ME

yes, even hidden code blocks!

print("hello world!")
@russelldb
russelldb / tmux.md
Last active May 8, 2021 — forked from andreyvit/tmux.md
tmux cheatsheet
View tmux.md

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

# remap prefix to Control + a
@zulhfreelancer
zulhfreelancer / heroku_pg_db_reset.md
Last active Apr 29, 2021
How to reset PG Database on Heroku?
View heroku_pg_db_reset.md

How to reset PG Database on Heroku?

  • Step 1: heroku restart
  • Step 2: heroku pg:reset DATABASE (no need to change the DATABASE)
  • Step 3: heroku run rake db:migrate
  • Step 4: heroku run rake db:seed (if you have seed)

One liner

heroku restart; heroku pg:reset DATABASE --confirm APP-NAME; heroku run rake db:migrate

@IanVaughan
IanVaughan / vim.md
Last active Dec 22, 2015
My VIM help
View vim.md

Misc

  • CTRL+Q - Turns on flow-control (if you turned it off by mistake)
  • CTRL+a - increment number
  • :cw - toggle quickfix list
  • CTRL+E - scroll window down (cursor stays)
  • CTRL+Y - scroll window up (cursor stays)
  • :r - retrive (:r filename - loads file at cursor. :r !ls - loads ls at cur)

Commands

  • :x - exit (with save)
@pvdb
pvdb / process_rss.rb
Last active Mar 10, 2021
Get real memory (resident set) used by current Ruby process
View process_rss.rb
#
# This first version should work on Mac OS X and Linux, but it spawns a process
#
# http://stackoverflow.com/questions/7220896/
# https://github.com/rdp/os/blob/master/lib/os.rb#L127
# http://www.ruby-doc.org/core-2.0/Process.html
#
# the real memory (resident set) size of the process (in 1_024 byte units).
def Process.rss() `ps -o rss= -p #{Process.pid}`.chomp.to_i ; end
@creaktive
creaktive / rainbarf.zsh
Last active Nov 10, 2020
rainbarf sans tmux (to enable, "source rainbarf.zsh", under zsh)
View rainbarf.zsh
# abort if already under tmux
[[ -n $TMUX_PANE ]] && return
# zsh-specific includes
zmodload -i zsh/datetime
zmodload -i zsh/stat
# place to store the chart
RAINBARF_OUT=~/.rainbarf.out
# update period, in seconds
@matsadler
matsadler / ruby-2.0.0-in-detail.md
Last active Dec 14, 2015
Detailed rundown of many of the new features in Ruby 2.0.0.
View ruby-2.0.0-in-detail.md

Ruby 2.0.0 in detail

Keyword arguments

def wrap(string, before: "<", after: ">")
  "#{before}#{string}#{after}" # no need to retrieve options from a hash
end

# optional
@timblair
timblair / ayb12.md
Created Nov 23, 2012
Notes from All Your Base 2012, 2012-11-23
View ayb12.md

AYB12

Alvin Richards: MongoDB

  • Trade-off: scale vs. functionality. MongoDB tries to have good functionality and good scalability.
  • Auto-sharding to maintain equilibrium between shards
  • Scalable datastore != scalable application: use of datastore may still be non-scalable (e.g. many queries across all shards)
  • Get low latency by ensuring shard data is always in memory: datastore
@piscisaureus
piscisaureus / pr.md
Created Aug 13, 2012
Checkout github pull requests locally
View pr.md

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this: