Skip to content

Instantly share code, notes, and snippets.

View padi's full-sized avatar

Marc Ignacio padi

View GitHub Profile
@padi
padi / bbatsovize.md
Last active April 29, 2016 05:18
Sane way of slowly following code conventions

Sane way of slowly following code conventions

If you're familiar with bbatsov/ruby-style-guide, you can immediately bbatsov-ize the files you changed in a (current) feature branch:

git diff origin/master --name-status | awk '{print $2}' | xargs rubocop --auto-correct

That roughly transates to: get all changed files in the current feature branch and run each file through rubocop, autocorrecting (modifying) the files if possible.

I recommend saving the changes in a separate commit for easier code reviews.

@padi
padi / slim_spec_helper.rb
Last active September 1, 2016 05:53
Fat-free RSpec test setup for Plain Old Ruby Objects within Rails.
# spec_helper for faster testing of plain old ruby objects
# To check if a spec is ready for this spec_helper,
# just replace `require "spec_helper"`
# with `require "slim_spec_helper"` and edit
# this file as necessary
# Loads a subset of the gemfile using bundler/inline
begin
require "bundler/inline"
rescue LoadError => e
@padi
padi / pomo.sh
Last active October 19, 2016 05:59
pomo.sh stupidly simple pomodoro on macOS if you just want something to notify you after 25 minutes then 5 minutes after
#!/bin/bash
osascript -e "display notification with title \"Start Pomodoro!\" sound name \"Hero.aiff\"" && \
(sleep 1500 | pv --timer) && \
osascript -e "display notification with title \"Pomodoro Break!\" sound name \"Hero.aiff\"" && \
(sleep 300 | pv --timer) && \
# (sleep 900 | pv --timer) &&\ # Uncomment for long breaks;
osascript -e "display notification with title \"Pomodoro Break Done!\" sound name \"Hero.aiff\""
@padi
padi / tmux-cheatsheet.markdown
Created November 11, 2016 07:21 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@padi
padi / redis.markdown
Created December 28, 2016 05:50 — forked from bdotdub/redis.markdown
Running redis using upstart on Ubuntu

Running redis using upstart on Ubuntu

I've been trying to understand how to setup systems from the ground up on Ubuntu. I just installed redis onto the box and here's how I did it and some things to look out for.

To install:

@padi
padi / .zshrc
Created February 14, 2017 04:34 — forked from sophiedeziel/.zshrc
Only run Rubocop on files changed in a branch
alias rdm="git diff master --name-only --diff-filter=ACMR | grep '.rb' | ag -v 'schema' | xargs rubocop"
@padi
padi / run_rubocop_in_branch.sh
Created February 14, 2017 23:27
Check rubocop against file changes in your feature-branch (compared to origin/master)
git diff origin/master --name-only --diff-filter=ACMR | grep '.rb' | ag -v 'schema' | xargs rubocop -c .rubocop.yml --force-exclusion --display-cop-names
@padi
padi / run_rubocop_in_branch.sh
Created February 14, 2017 23:27
Check rubocop against file changes in your feature-branch (compared to origin/master)
git diff origin/master --name-only --diff-filter=ACMR | grep '.rb' | grep -v 'schema' | xargs rubocop -c .rubocop.yml --force-exclusion --display-cop-names
@padi
padi / kill_rubies.sh
Created August 17, 2017 02:46
Script to kill all spring and rogue ruby processes
#!/bin/sh
ps aux | grep ruby | grep -v grep | awk '{print $2}' | xargs kill