Skip to content

Instantly share code, notes, and snippets.

anonymous
anonymous / factories.rb
Created February 24, 2010 05:05
Factory.define :item do |f|
include ActionDispatch::TestProcess
f.name "Macbook Pro 15"
f.price_in_dollars 1500
f.photo fixture_file_upload('/files/avatar.jpg', 'image/jpg')
end
@chrisroos
chrisroos / gpg-import-and-export-instructions.md
Created September 9, 2011 10:49
Instructions for exporting/importing (backup/restore) GPG keys

Every so often I have to restore my gpg keys and I'm never sure how best to do it. So, I've spent some time playing around with the various ways to export/import (backup/restore) keys.

Method 1

Backup the public and secret keyrings and trust database

cp ~/.gnupg/pubring.gpg /path/to/backups/
cp ~/.gnupg/secring.gpg /path/to/backups/
cp ~/.gnupg/trustdb.gpg /path/to/backups/

or, instead of backing up trustdb...

@amalagaura
amalagaura / ability.rb
Created December 13, 2011 20:23 — forked from watson/ability.rb
Active Admin CanCan integration with shared front/backend User model and multi-level autherization
# app/models/ability.rb
# All front end users are authorized using this class
class Ability
include CanCan::Ability
def initialize(user)
user ||= User.new
can :read, :all
@Irio
Irio / gist:1496746
Created December 19, 2011 11:24
Solution for "cannot load such file -- openssl" on RVM
When I tried run "rake test", I received:
rake aborted!
cannot load such file -- openssl
Tasks: TOP => test:units => test:prepare => db:test:prepare => db:abort_if_pending_migrations => environment
(See full trace by running task with --trace)
@nz
nz / configuring tire for bonsai.md
Last active October 1, 2015 18:58
Configuring Tire to work with Bonsai

1. Configure Tire to use the Bonsai ElasticSearch Heroku add-on

gem 'tire'

config/initializers/bonsai.rb

ENV['ELASTICSEARCH_URL'] = ENV['BONSAI_URL']
@nateware
nateware / haproxy.conf
Created October 31, 2012 15:36
HAProxy sample config for EC2
#
# This config file is a combination of ideas from:
# http://www.37signals.com/svn/posts/1073-nuts-bolts-haproxy
# http://www.igvita.com/2008/05/13/load-balancing-qos-with-haproxy/
# http://wiki.railsmachine.com/HAProxy
# http://elwoodicious.com/2008/07/15/nginx-haproxy-thin-fastcgi-php5-load-balanced-rails-with-php-support/
# http://upstream-berlin.com/2008/01/09/using-haproxy-with-multiple-backends-aka-content-switching/
# http://wiki.railsmachine.com/HAProxy
# http://gist.github.com/raw/25482/d39fb332edf977602c183194a1cf5e9a0b5264f9
#
@rey
rey / irssi-config-example
Last active April 13, 2023 19:34
Irssi config example
servers = (
{
address = "irc.freenode.net";
chatnet = "freenode";
port = "6667";
use_ssl = "no";
ssl_verify = "no";
autoconnect = "yes";
}
);
@rummelonp
rummelonp / 0-yoru_fukurou_list_sync.md
Created December 20, 2012 17:10
Twitter Lists から YoruFukurou の抽出タブを同期するスクリプト書いた

Twitter Lists から YoruFukurou の抽出タブを同期するスクリプト書いた

なんでわざわざ抽出タブ作ってるか理由を説明するのは面倒くさいから省く
ただリストから抽出タブを作ってる人は他にもいるみたいでどうにか自動化出来ないかなと書いてみた

前提条件

  • Mac 使ってる
  • YoruFukurou 使ってる
  • Ruby が入ってる
@Awea
Awea / Gemfile
Last active December 14, 2015 07:39
Markdown to Html with code highlight
gem 'redcarpet'
gem 'pygmentize'
# https://github.com/barsoom/attr_extras
require "attr_extras"
class UserSession
pattr_initialize :controller, :session_key, :finder
# NOTE: Not memoized yet.
def user
if id
finder.find(id)