Skip to content

Instantly share code, notes, and snippets.

View faun's full-sized avatar
🌵

Faun faun

🌵
View GitHub Profile
@faun
faun / node-and-npm-in-30-seconds.sh
Created May 24, 2011 22:34 — forked from isaacs/node-and-npm-in-30-seconds.sh
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl http://npmjs.org/install.sh | sh
@faun
faun / build.sh
Created September 6, 2011 21:55 — forked from kossnocorp/USAGE.md
Install latest MacVim with Drawer
git clone -b split-browser https://github.com/alloy/macvim.git && cd macvim && ./configure --with-features=huge --enable-cscope --enable-rubyinterp --enable-pythoninterp --enable-perlinterp && make && sudo rm -rf /Applications/MacVim.app && sudo mv ./src/MacVim/build/Release/MacVim.app /Applications
@faun
faun / ios-media-queries.sass
Created November 28, 2011 21:33 — forked from adamstac/ios-media-queries.sass
iOS Media Queries for iPhone/iPod, iPad & Retina and Non-Retina Devices
.ipad-only,
.iphone-only,
.retina-only,
.non-retina-only,
.retina-iphone-only,
.non-retina-iphone-only
display: none
// iPad Only
@media only screen and (device-width: 768px)
@faun
faun / pre-commit
Last active October 22, 2022 14:54
Pre-commit hook to prevent committing invalid ruby files or binding.pry Runs cane on *.ruby files, jshint on *.js files and coffeelint on *.coffee files # place this file in ./script/pre-commit # and install with: # chmod +x ./script/pre-commit # ln -s ../../script/pre-commit .git/hooks/pre-commit
#!/bin/bash
## START PRECOMMIT HOOK
files_modified=`git status --porcelain | egrep "^(A |M |R ).*" | awk ' { if ($3 == "->") print $4; else print $2 } '`
[ -s "$HOME/.rvm/scripts/rvm" ] && . "$HOME/.rvm/scripts/rvm"
## use ruby defined in project
source .rvmrc
for f in $files_modified; do
@faun
faun / glacier_restore.rb
Created November 17, 2012 01:53
Restore files from Amazon Glacier in blulk
#!/usr/bin/env ruby
require 'base64'
require 'openssl'
require 'digest/sha1'
require 'net/http'
require "uri"
require 'time'
DEBUG = false
require 'nokogiri'
RSpec::Matchers.define :have_xml do |xpath, text|
match do |body|
doc = Nokogiri::XML::Document.parse(body)
nodes = doc.xpath(xpath)
nodes.empty?.should be_false
if text
nodes.each do |node|
node.content.should == text
end
@faun
faun / Gemfile
Last active December 11, 2015 19:48
Gemfile
source 'https://rubygems.org'
gem 'rails', '~> 3.2.11'
#...
group :test, :development do
gem "rspec-rails", "~> 2.0"
gem 'capybara', "~> 2.0.2"
gem "factory_girl_rails", "~> 4.0"
@faun
faun / application.rb
Last active December 11, 2015 19:48
config/application.rb
module MyApp
class Application < Rails::Application
#...
config.generators do |g|
g.test_framework :rspec,
fixtures: true,
view_specs: false,
helper_specs: false,
@faun
faun / spec_helper.rb
Last active December 11, 2015 19:48
spec/spec_helper.rb
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
require 'capybara/rspec'
#...
FactoryGirl.find_definitions