Skip to content

Instantly share code, notes, and snippets.

View scottjacobsen's full-sized avatar

Scott Jacobsen scottjacobsen

View GitHub Profile

Welcome to #rubyonrails

Please behave in a polite, considerate and inclusive manner in the channel at all times. People volunteer their time in the channel to help people like you with your Rails problems and some respect (in both directions) will go an extremely long way.

These rules are in place so that you can get the quickest and best support from #rubyonrails.

Rule #0: Show rather than tell. Explaining your problem with code, stacktraces or errors is always preferred to explaining it with just text. Show us what's happening, rather than telling us.

  1. Do your research before hand. Your question may be answerable with a quick Google search or by simply experimenting. If you're using a method in Rails, look it up in the API Docs or in the Official Guides.
  2. If you've tried Googling, explain what terms you've tried to use so people can better help you.
@denmarkin
denmarkin / resque.rake
Created September 20, 2011 11:02
My rake task for clearing Resque queues and stats
# see http://stackoverflow.com/questions/5880962/how-to-destroy-jobs-enqueued-by-resque-workers - old version
# see https://github.com/defunkt/resque/issues/49
# see http://redis.io/commands - new commands
namespace :resque do
desc "Clear pending tasks"
task :clear => :environment do
queues = Resque.queues
queues.each do |queue_name|
puts "Clearing #{queue_name}..."
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active April 16, 2024 22:44
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@tompave
tompave / nginx.conf
Last active August 15, 2022 10:18
commented nginx.conf for Ruby on Rails
# A commented nginx configuration file for Ruby on Rails
#
# Author: Tommaso Pavese
# tommaso@pavese.me
# http://tommaso.pavese.me
#
# License: http://www.wtfpl.net/
#
#
# Tested with:
@john2x
john2x / 00_destructuring.md
Last active April 10, 2024 19:12
Clojure Destructuring Tutorial and Cheat Sheet

Clojure Destructuring Tutorial and Cheat Sheet

(Related blog post)

Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.

Vectors and Sequences

@matthewmueller
matthewmueller / osx-for-hackers.sh
Last active February 22, 2024 08:52
OSX for Hackers (Mavericks/Yosemite)
# OSX for Hackers (Mavericks/Yosemite)
#
# Source: https://gist.github.com/brandonb927/3195465
#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Ask for the administrator password upfront
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
@michaelfeathers
michaelfeathers / gist:1e2934ebb95560cddc3b
Created April 3, 2015 02:05
return a string that represents increases, decreases, and stable changes in a method's length
# :: [event] -> String -> String
def method_delta_line es, method_name
es.select {|e| e.method_name == method_name }
.map(&:method_length)
.each_cons(2)
.map {|c,n| ["^","v","-"][(c <=> n) + 1] }
.join
end
@justjanne
justjanne / Price Breakdown.md
Last active April 11, 2024 22:21 — forked from kylemanna/price.txt
Server Price Breakdown: DigitalOcean, Amazon AWS LightSail, Vultr, Linode, OVH, Hetzner, Scaleway/Online.net:

Server Price Breakdown: DigitalOcean, Amazon AWS LightSail, Vultr, Linode, OVH, Hetzner, Scaleway/Online.net:

Permalink: git.io/vps

$5/mo

Provider Type RAM Cores Storage Transfer Network Price
@BretFisher
BretFisher / present.zsh-theme
Last active September 22, 2023 11:33
oh-my-zsh theme for presentations (hides prompt features based on path)
# problem: when presenting, I want to obscure
# my prompt to act like it's at root of file system
# and be very basic with no git info, etc.
# solution: this theme lets you set a ENV to the path
# of your presentation, which will help remove unneeded prompt
# features while in that path
# oh-my-zsh theme for presenting demos
# based off the default rubbyrussell theme