Skip to content

Instantly share code, notes, and snippets.

View IanVaughan's full-sized avatar
👯‍♀️
OMG

Ian Vaughan IanVaughan

👯‍♀️
OMG
View GitHub Profile
@matsadler
matsadler / ruby-2.0.0-in-detail.md
Last active December 14, 2015 16:29
Detailed rundown of many of the new features in Ruby 2.0.0.

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
@creaktive
creaktive / rainbarf.zsh
Last active January 27, 2023 18:44
rainbarf sans tmux (to enable, "source rainbarf.zsh", under 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
@pvdb
pvdb / process_rss.rb
Last active December 14, 2022 10:50
Get real memory (resident set) used by current Ruby process
#
# 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
#
# A better - but more complicated - way to achieve the same is documented here:
#
# https://build.betterup.com/tracking-a-processs-memory-usage-in-ruby/
@IanVaughan
IanVaughan / vim.md
Last active December 22, 2015 05:28
My VIM help

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)
@zulhfreelancer
zulhfreelancer / heroku_pg_db_reset.md
Last active January 29, 2024 10:09
How to reset PG Database on Heroku (for Rails app)?

It's important to note that running this reset will drop any existing data you have in the application

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

@russelldb
russelldb / tmux.md
Last active October 18, 2023 14:48 — forked from andreyvit/tmux.md
tmux cheatsheet

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

@joyrexus
joyrexus / README.md
Last active February 24, 2024 15:16
collapsible markdown

collapsible markdown?

CLICK ME

yes, even hidden code blocks!

print("hello world!")
@grodowski
grodowski / merge_coverage.rb
Last active September 26, 2022 04:28
Merge coverage reports from parallel circle test containers
#!/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|