Skip to content

Instantly share code, notes, and snippets.

@stevenharman
stevenharman / sidekiq.rb
Last active March 6, 2020 17:35
The best solution I've found for reliably configuring Sidekiq's ActiveRecord connection pool size on Heroku.
# /config/initializers/sidekiq.rb
current_web_concurrency = Proc.new do
web_concurrency = ENV['WEB_CONCURRENCY']
web_concurrency ||= Puma.respond_to?
(:cli_config) && Puma.cli_config.options.fetch(:max_threads)
web_concurrency || 16
end
local_redis_url = Proc.new do
@rxaviers
rxaviers / gist:7360908
Last active July 23, 2024 12:26
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@danriti
danriti / hipchat-v2.sh
Last active July 18, 2024 14:34
HipChat API v2 - Send a message to a room using cURL
#!/bin/bash
# Set the ROOM_ID & AUTH_TOKEN variables below.
# Further instructions at https://www.hipchat.com/docs/apiv2/auth
ROOM_ID=XXX
AUTH_TOKEN=XXX
MESSAGE="Hello world!"
curl -H "Content-Type: application/json" \
@jswanner
jswanner / migrate.rake
Last active April 1, 2021 22:05
Rolls back migrations in current branch not present in specified branch.
desc 'rolls back migrations in current branch not present in other'
task :rollback_branch_migrations, [:other_branch] do |t, args|
load "#{Dir.pwd}/Rakefile"
branch_migrations = BranchMigrations.new(args.other_branch)
puts ['Rollback the following migrations', branch_migrations, 'y,n? ']
next if %w[no n NO N].include?(STDIN.gets.chomp)
Rake::Task['environment'].invoke
@coreyhaines
coreyhaines / .rspec
Last active April 11, 2024 00:19
Active Record Spec Helper - Loading just active record
--colour
-I app
@myobie
myobie / mountain-lion-brew-setup.markdown
Created February 18, 2012 20:14
Get Mountain Lion and Homebrew to Be Happy

Get Mountain Lion and Homebrew to Be Happy

1) Install XCode 4.4 into /Applications

Get it from the App Store.

2) Install Command Line Tools

In XCode's Preferences > Downloads you can install command line tools.

@teamon
teamon / guide.sh
Created July 28, 2011 19:11
Pow + nginx configuration aka give me back my 80 port!
# Install pow
$ curl get.pow.cx | sh
# Install powder
$ gem install powder
# See that firewall is fucked
$ sudo ipfw show
00100 0 0 fwd 127.0.0.1,20559 tcp from any to me dst-port 80 in <- THIS ONE!!!
65535 81005 28684067 allow ip from any to any
@nathansmith
nathansmith / web-design-development-learning-resources.md
Last active May 29, 2024 12:25
Resources for learning web design & front-end development
@danielevans
danielevans / rubber1
Created April 5, 2011 18:16
output from a rubber create_staging call
gate@tolanna:~/Work/project-rails/project$ RUBBER_ENV=rubbertest cap rubber:create_staging
triggering load callbacks
* executing `rubber:init'
* executing `rubber:create_staging'
Hostname to use for staging instance [rubbertest]:
Roles to use for staging instance [web,app,db:primary=true]:
* executing `rubber:create'
* Creating new security group: project_rubbertest_app
* Creating new security group: project_rubbertest_passenger
* Creating new security group: project_rubbertest_default
#!/usr/bin/env ruby -wKU
require "net/http"
require "uri"
####################### Standard HTTP Request #######################
def standard_http_request
uri = URI.parse("http://wwwgoogle.com.hk")
# Shortcut