Skip to content

Instantly share code, notes, and snippets.

@listrophy
listrophy / Custom.css
Created January 3, 2013 15:40
Put this in "~/Library/Application Support/Google/Chrome/Default/User StyleSheets/Custom.css" to highlight your blocked stories.
.projects_stories_page .storyLabels a[title="blocked"] {
background-color: red;
color: white !important;
padding: 0 3px;
display: inline-block;
}
@schubert
schubert / example.bash
Created July 27, 2012 19:05
nginx config trick to force specific return code for testing
$ curl -I http://some.local.app.dev/?return=402
HTTP/1.1 402 Payment Required
Server: nginx/1.2.2
Date: Fri, 27 Jul 2012 19:08:19 GMT
Content-Type: text/html
Content-Length: 182
Connection: keep-alive
Keep-Alive: timeout=10
@MicahElliott
MicahElliott / clj-fold.vim
Created July 4, 2012 19:42 — forked from dakrone/gist:519858
Automagic Clojure folding on defns and defmacros
" ---------------------------------------------------------------------------
" Automagic Clojure folding on defn's and defmacro's
"
" Blog post: http://writequit.org/blog/?p=413
function GetClojureFold()
if getline(v:lnum) =~ '^\s*(defn.*\s'
return ">1"
elseif getline(v:lnum) =~ '^\s*(def\(macro\|method\|page\|partial\).*\s'
return ">1"
class SignUpPage
def initialize
current_path.should == sign_up_path
end
def with_email(email)
fill_in "Login", :with => email
end
def with_password(password, confirmation = password)
@pivotalneutron
pivotalneutron / gist:1055856
Created June 30, 2011 08:22
Removing stale resque workers from Redis
# When resque workers are no longer around, but records of them are still sitting around in Redis...
def remove_resque_workers worker, ips
ips.each do |ip|
eval("
def worker.to_s
'#{ip}:*'
end
")
worker.unregister_worker
@pivotalneutron
pivotalneutron / gist:994591
Created May 27, 2011 03:32
Extracting failed IDs from migration jobs and requeueing them
Resque::Failure.all(28044, Resque::Failure.count - 28044).each do |j|
next unless j["retried_at"].nil?
e = j["error"]
ids = e[(e.index('[')+1)...e.index(']')].split(', ').map(&:to_i)
Jobs::MigrateLegacyUsers.submit_job(ids)
end
@pivotalneutron
pivotalneutron / gist:966089
Created May 11, 2011 08:05
Removing nodes & clients from chef server
numbers_to_delete = (10..20).to_a # or any array of numbers you need to operate on
name_prefix = 'server-name-prefix-' # will be used in a search, ie: "name:server-name-prefix-11"
names_to_delete = numbers_to_delete.map { |i| "#{name_prefix}#{i}" }
nodes_to_destroy = search(:node, names_to_delete.map { |n| "name:#{n}" }.join(" OR "))
nodes_to_destroy.each { |n| n.destroy }
clients_to_destroy = search(:client, names_to_delete.map { |n| "name:#{n}" }.join(" OR "))
clients_to_destroy.each { |c| c.destroy }
@tmilewski
tmilewski / gist:820666
Created February 10, 2011 15:11
Verbose be_valid RSpec matcher
RSpec::Matchers.define :be_valid do
match do |model|
model.valid?
end
failure_message_for_should do |model|
"expected valid? to return true, got false:\n #{model.errors.full_messages.join("\n ")}"
end
failure_message_for_should_not do |model|
" ---------------------------------------------------------------------------
" Automagic Clojure folding on defn's and defmacro's
"
function GetClojureFold()
if getline(v:lnum) =~ '^\s*(defn.*\s'
return ">1"
elseif getline(v:lnum) =~ '^\s*(defmacro.*\s'
return ">1"
elseif getline(v:lnum) =~ '^\s*(defmethod.*\s'
return ">1"
@ghoseb
ghoseb / ns-cheatsheet.clj
Last active September 14, 2024 10:11 — forked from alandipert/ns-cheatsheet.clj
Clojure ns syntax cheat-sheet
;;
;; NS CHEATSHEET
;;
;; * :require makes functions available with a namespace prefix
;; and optionally can refer functions to the current ns.
;;
;; * :import refers Java classes to the current namespace.
;;
;; * :refer-clojure affects availability of built-in (clojure.core)
;; functions.