Skip to content

Instantly share code, notes, and snippets.

View mattscilipoti's full-sized avatar

Matt Scilipoti mattscilipoti

View GitHub Profile
alias gst='git status '
alias gc='git commit '
alias gca='git commit -a '
alias ga='git add '
alias gco='git checkout '
alias gb='git branch '
alias gd='git diff '
alias gm='git merge '
alias gmm='git merge master'
alias gcom='git checkout master'
@mattscilipoti
mattscilipoti / cucumber.yml
Created June 6, 2012 14:58
cucumber.yml that moves rerun.txt to tmp (DRYly)
<%
# vars for default formats. These are overridden by command line args.default_format_multi = "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'}"
default_format_single = "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'}"
html_report_options = " --format html --out='public/reports/features.html'"
# Use tmp dir for rerun.txt (vs. root)
rerun_file = File.join('tmp', 'rerun.txt')
rerun = File.file?(rerun_file) ? IO.read(rerun_file) : ""
rerun_format = "--format rerun --out #{ rerun_file }"
@mattscilipoti
mattscilipoti / rake-hooks(newly-minted).gemspec
Created June 19, 2012 14:20
gem rake-hooks (1) has an invalid gemspec
# -*- encoding: utf-8 -*-
require File.expand_path('../lib/rake/hooks/version', __FILE__)
Gem::Specification.new do |gem|
gem.authors = ["Matt Scilipoti"]
gem.email = ["matt@scilipoti.name"]
gem.description = %q{Is this valid?}
gem.summary = %q{I hope it is valid}
gem.homepage = ""
@mattscilipoti
mattscilipoti / postgres.rake
Last active May 1, 2019 18:42
rake db:kill_postgres_connections
puts "WARN: We are patching rake tasks to support postgres. You have upgraded Rails and may not need this patch any more (lib/tasks/postgres.rake)." if Rails.version > "3.2.8"
namespace :db do
desc 'kills connections to postgres db'
task :kill_postgres_connections => :environment do
env = ENV['RAILS_ENV']
db_config = Rails.configuration.database_configuration[env]
fail(ArgumentError, "Could not find db config entry for env (#{env})") unless db_config
db_name = db_config['database']
db_tasks = %w[db:migrate db:migrate:up db:migrate:down db:rollback db:seed db:version] # db:forward]
namespace :multitenant do
desc 'List all existing tenants/customers'
task :list => :environment do
puts Customer.all.collect &:name
end
#create a multitenant task for each db task
db_tasks.each do |task_name|
@mattscilipoti
mattscilipoti / syntax_highlighter_footer.js
Created November 10, 2013 16:20
The snippets I use for blog.clearto.me
@mattscilipoti
mattscilipoti / pre-push.sh
Last active January 3, 2016 06:39 — forked from pixelhandler/pre-push.sh
pre-push script: Protects some branches from destructive actions.
#!/usr/bin/env ruby
# NOTE! this is a work in progress. This is not tested or used regularly.
# Ensures we do not call destructive commands on protected branches.
#
# Called by "git push" after it has checked the remote status,
# but before anything has been pushed.
#
# If this script exits with a non-zero status nothing will be pushed.
#!/usr/bin/env ruby
# Used to convert json from MixPanel into csv
# see: https://stackoverflow.com/questions/7845015/convert-json-to-csv-in-ruby
# and: https://stackoverflow.com/questions/273262/best-practices-with-stdin-in-ruby
class MixPanelJsonToCsv
require 'csv'
require 'optparse'
attr_reader :config
@mattscilipoti
mattscilipoti / GeometrySpecRunner.html
Created November 7, 2014 17:09
Using Jasmine from jasmine-node OR html (interchangeably)
<!DOCTYPE html>
<html>
<head>
<title>geometry specs</title>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/jasmine/2.0.0/jasmine.css">
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jasmine/2.0.0/jasmine.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jasmine/2.0.0/jasmine-html.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jasmine/2.0.0/boot.js"></script>
@mattscilipoti
mattscilipoti / rspec_cheat_sheet.rd
Last active August 29, 2015 14:26 — forked from byplayer/rspec_cheat_sheet.rd
rspec cheat sheet
INSTALL
=======
$ gem install rspec
RSPEC-RAILS
===========
RAILS-3
=======