Skip to content

Instantly share code, notes, and snippets.

@prusswan
prusswan / gist:79789c6d9affa889e2ac
Created October 6, 2015 06:05 — forked from schacon/gist:942899
delete all remote branches that have already been merged into master
$ git branch -r --merged |
grep origin |
grep -v '>' |
grep -v master |
xargs -L1 |
awk '{split($0,a,"/"); print a[2]}' |
xargs -I% git push v2 :%
@prusswan
prusswan / Gemfile
Last active September 3, 2015 04:14 — forked from eritiro/Gemfile
Working Gemfile for rails 5 app (alpha version)
source 'https://rubygems.org'
ruby '2.2.3'
gem 'rails', github: "rails/rails"
gem 'sprockets-rails', github: 'rails/sprockets-rails'
gem 'sprockets', github: "rails/sprockets"
gem 'sass-rails', github: "rails/sass-rails"
gem 'arel', github: "rails/arel"
gem 'rack', github: "rack/rack"
#!/bin/bash
PHANTOM_JS="phantomjs-1.9.8-linux-x86_64"
if [[ $EUID -ne 0 ]]; then
echo "You must be a root user" 2>&1
exit 1
else
apt-get update
apt-get install -y build-essential chrpath libssl-dev libxft-dev
apt-get install -y libfreetype6 libfreetype6-dev
apt-get install -y libfontconfig1 libfontconfig1-dev
@prusswan
prusswan / install.sh
Last active August 29, 2015 14:09
ruby 1.9.3 rbenv tcl tk
sudo ln -s /usr/lib/x86_64-linux-gnu/libtcl8.5.so.0 /usr/lib/libtcl8.5.so.0
sudo ln -s /usr/lib/x86_64-linux-gnu/libtk8.5.so.0 /usr/lib/libtk8.5.so.0
sudo ln -s /usr/lib/x86_64-linux-gnu/tcl8.5/tclConfig.sh /usr/lib/tclConfig.sh
sudo ln -s /usr/lib/x86_64-linux-gnu/tk8.5/tkConfig.sh /usr/lib/tkConfig.sh
RUBY_CONFIGURE_OPTS="--with-tcl-include=/usr/include/tcl8.5
--with-tcllib=tcl8.5 --with-tklib=tk8.5 --with-tcltkversion=8.5
--with-tk-include=/usr/include/tcl8.5
--with-tclConfig-file=/usr/lib/tclConfig.sh
@prusswan
prusswan / .bash_aliases
Last active August 29, 2015 13:58
My favorite settings for Ubuntu
# Customize BASH PS1 prompt to show current GIT repository and branch.
# by Mike Stewart - http://MediaDoneRight.com
# SETUP CONSTANTS
# Bunch-o-predefined colors. Makes reading code easier than escape sequences.
# I don't remember where I found this. o_O
# Reset
Color_Off="\[\033[0m\]" # Text Reset
@prusswan
prusswan / backports for rake-compiler + mingw_w64 4.6
Last active June 20, 2022 07:47
ruby backports for building against mingw_w64 4.6 using rake-compiler
1.9.1-p243:
r31351 + r27300 # mingw-w64 issue with truncate/ftruncate (http://bugs.ruby-lang.org/issues/4564)
r28811 # x86_64 mingw defines stati64 (http://bugs.ruby-lang.org/issues/2588)
r26311 # redefinition of 'struct timezone' (http://bugs.ruby-lang.org/issues/2587)
1.8.6-p398:
r28144 + r28223 # winsock2 issue (http://bugs.ruby-lang.org/issues/3382)
# Setting up dnsmasq for Local Web Development Testing on any Device
Please note, these instructions are for OS X Lion.
First, you need to get the IP address of your machine on your local network. In OS X, the easiest place to find this is in System Preferences > Network. If you're using DHCP on your local network, you will want to make sure your computer requests the same IP address when it renews it's IP address lease. I recommend configuring the DCHP Reservation settings on your router to accomplish this. Otherwise, you can specify a manual address in your network settings:
1. Go to *System Preferences > Network*
1. Click *Advanced...*
## https://github.com/jnicklas/capybara
#=Navigating=
visit('/projects')
visit(post_comments_path(post))
#=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
@prusswan
prusswan / r4ia.txt
Last active December 19, 2015 11:29
Rails 4 in Action 1P review notes
1.2.4 Scaffolding
binstubs was only introduced later on, so bin/rails makes no sense
Listing 1.16
update(purchase_params) is used instead of update_attributes(params[:purchase])
@prusswan
prusswan / bundle-viz.rb
Created June 18, 2013 23:41
Customizing graphviz options for `bundle viz`
require 'graphviz'
require 'bundler'
module Bundler
class Graph
class GraphVizClient
def g
@g ||= ::GraphViz.digraph(@graph_name, {
:use => 'neato',
:concentrate => true,