Skip to content

Instantly share code, notes, and snippets.

View padi's full-sized avatar

Marc Ignacio padi

View GitHub Profile
@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 / .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 / 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 / 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 / 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 / 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 / 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 / ansible.md
Created November 27, 2013 07:48 — forked from rstacruz/ansible.md
@padi
padi / README.txt
Created September 12, 2013 05:48 — forked from rdetert/README.txt
The purpose of all this is to see if sphinx, thinking sphinx and thinking sphinx delayed delta are all working properly.
I created a test controller on a separate monit subdomain that simply generates and posts a test value and then uses curl to retrieve it. If the two values match, then sphinx is working properly with delayed delta.
This example assumes a Linux installation.
The file 'delayed_delta.sh' spawns the `rake ts:dd` process in the background, saving its PID to tmp/pids in your Rails project. You can start and stop it by running '/etc/init.d/delayed_delta.sh start' and '/etc/init.d/delayed_delta.sh stop'. You will use these in your monitoring to, see the monitrc snippet.
In a crontab, every X seconds or minutes, run 'ar_sphinx_mon.sh' to see if records are properly being inserted and indexed. If they aren't, then kill all Thinking Sphinx processes and monit should restart them.
=> #<OpenStruct site_id="7018", currency_decimals="2", tax_decimals="2", tax_rate_1="7.0000", tax_rate_2="0.0000", regional_options="0", unit_type_id="28", unit_type_name="Drive Up Unit", has_charge_tax_1=true, has_charge_tax_2=true, def_lease_num="1", is_mobile=true, is_inside=true, floor="1", width="9.5000", length="20.0000", area="190.0000", push_rate="80.0000", standard_rate="100.0000", standard_weekly_rate="0.0000", total_units="1", total_units_occupied="1", total_units_vacant="0", total_units_reserved="1", first_available_unit_id="2972", first_available_unit_name="100", first_available_unit_description="This is a test. Ramp access, Elevator, interior", representative_unit_id="2972", representative_unit_name="100", representative_unit_description="This is a test. Ramp access, Elevator, interior", admin_fee="0.0000", reservation_fee="10.0000", is_first_available_unit_rented=true>
=> #<OpenStruct site_id="7018", currency_decimals="2", tax_decimals="2", tax_rate_1="7.0000", tax_rate_2="0.0000", regional_op