Skip to content

Instantly share code, notes, and snippets.

@mislav
mislav / Gemfile
Last active August 29, 2015 14:18 — forked from janko/benchmark.rb
source "https://rubygems.org"
gem "minitest"
gem "rspec"
@konklone
konklone / ssl.rules
Last active August 8, 2023 08:39
nginx TLS / SSL configuration options for konklone.com
# Basically the nginx configuration I use at konklone.com.
# I check it using https://www.ssllabs.com/ssltest/analyze.html?d=konklone.com
#
# To provide feedback, please tweet at @konklone or email eric@konklone.com.
# Comments on gists don't notify the author.
#
# Thanks to WubTheCaptain (https://wubthecaptain.eu) for his help and ciphersuites.
# Thanks to Ilya Grigorik (https://www.igvita.com) for constant inspiration.
server {
# A program that works jobs in newly created UNIX
# process by calling fork. The number of processes
# running at any given time is bounded by our use
# of a sized queue.
require 'thread'
# Run at most 4 UNIX processes for any given time.
@limiter = SizedQueue.new(4)
@JEG2
JEG2 / struct.md
Created June 3, 2013 21:50
Thinking out loud about the merits and drawbacks of two different usages of Struct…

How Should We Use Struct?

The Choice

It's common in Ruby to see some code setup a Struct like this:

class Specialized < Struct.new(:whatever)
  # ... define custom methods here...
end
@mislav
mislav / git.md
Last active May 20, 2020 14:52
git merge, reset, rebase, checkout

What I believe is the most confusing thing for git beginners is that the main commands have multiple uses depending on the arguments or context, and some of those uses aren't well-described by the command's name.

Merge

  • merges together different branches (different histories, to be more exact)
  • fast-forwards if a merge isn't necessary; effectively repositioning the branch head to a descendant commit
  • unwanted outcome of git pull

Rebase

@joshsusser
joshsusser / silence_assets.rb
Created April 17, 2012 22:34
put in config/initializers to silence asset logging in Rails development mode
if Rails.env.development?
Rails.application.assets.logger = Logger.new('/dev/null')
Rails::Rack::Logger.class_eval do
def call_with_quiet_assets(env)
previous_level = Rails.logger.level
Rails.logger.level = Logger::ERROR if env['PATH_INFO'] =~ %r{^/assets/}
call_without_quiet_assets(env)
ensure
@burke
burke / 0-readme.md
Created January 27, 2012 13:44 — forked from funny-falcon/cumulative_performance.patch
ruby-1.9.3-p327 cumulative performance patch for rbenv

ruby-1.9.3-p327 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.

Requirements

You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.

@chriseppstein
chriseppstein / rbenv-each.sh
Created October 12, 2011 15:49
Execute the same command in each installed ruby via rbenv
#!/bin/bash
verbose=0
function usage() {
echo >&2 "Usage: rbenv each [-v] ..."
echo >&2 " -v Verbose mode. Prints a header for each ruby."
}
while getopts vh option
do case "$option" in
@zerowidth
zerowidth / ar_pg_defaults.gemspec
Created October 4, 2011 16:11
Let postgres insert default values for columns with default values that AR 3.1 doesn't understand
Gem::Specification.new do |s|
s.name = "ar_pg_defaults"
s.version = "0.0.1"
s.platform = Gem::Platform::RUBY
s.author = "Nathan Witmer"
s.email = "nwitmer@gmail.com"
s.homepage = "https://gist.github.com/1262051"
s.summary = "Help AR let postgres do its thing"
s.description = "Let postgres insert default values for columns with default values that AR 3.1 doesn't understand"
@derekprior
derekprior / ruby_rogues_picks.md
Created July 28, 2011 20:56
A list of all picks from the Ruby Rogues podcast in one convenient location