Skip to content

Instantly share code, notes, and snippets.

View thewoolleyman's full-sized avatar

Chad Woolley thewoolleyman

View GitHub Profile
# http://www.jamesbritt.com/2007/12/18/sending-mail-through-gmail-with-ruby-s-net-smtp
# http://d.hatena.ne.jp/zorio/20060416
require "openssl"
require "net/smtp"
Net::SMTP.class_eval do
private
def do_start(helodomain, user, secret, authtype)
raise IOError, 'SMTP session already started' if @started
class User < ActiveRecord::Base
require 'digest/md5'
validates_presence_of :email, :password
def self.authenticate(email, password)
User.find_by_email_and_password(email, Digest::MD5.hexdigest(password))
end
def password=(password)
# Execute a block +number+ times. Block should be a predicate (return true/false)
#
# Use procs/lambdas to define callbacks:
# :success => ...
# :retry => ...
# :failure => ...
def do_over(number, options = {}, &block)
options = {
:success => lambda { puts "SUCCESS" },
:retry => lambda { puts "RETRY" },
#!/usr/bin/env ruby
# This script copies all .gem files for all versions of a gem from gems.github.com to gemcutter.org.
# For all versions of a gem, it does a gem fetch, repackages the gem with the non-namespaced name,
# and does a gem push. You must have permission to push the gem, so your gemcutter key must be
# set in ~/.gemrc
require 'rubygems'
require 'yaml'
require 'fileutils'
require 'rubygems'
require 'test/unit'
require 'mongo'
def rating(query)
collection_size = query.collection.count
return 100 if collection_size <= 1
explanation = query.explain
return 0 if collection_size > 1 and explanation['startKey'].empty?
#!/bin/bash -xe
EBS_DEVICE='/dev/sdh'
INSTANCE_ID=$1
AKI=${2:-'aki-5f15f636'}
ARI=${3:-'ari-0915f660'}
ARCH=${4:-'i386'}
SIZE=${5:-10}
AZ=${6:-'us-east-1d'}
NAME=${7:-"ami-from-$INSTANCE_ID"}
Rails CMS alternatives
======================
Note: project activity was checked on 11/26/09 for most of these projects, and the "last update" field has not been kept up to date since then.
Active projects:
---------------
adva-cms
repo: http://github.com/svenfuchs/adva_cms/
site: http://adva-cms.org/
Last update: 11/24/09
This is an example of using RVM's Project .rvmrc file
to have it automatically bootstrap your environment, including bundler.
This could be further expanded to do anything you require :)
The important thing to remember is that the purpose of these files is
to allow you to very easily have your 'project context' (aka 'environment')
loaded automatically for you when you enter the project in the shell (cd).
You can generate the .rvmrc file below by running:
Change the URL for rubygems_1.3.7_ur in ~/.rvm/config/db to http://rvm.beginrescueend.com/src/rubygems-1.3.7.tgz
and/or download http://rvm.beginrescueend.com/src/rubygems-1.3.7.tgz into ~/.rvm/archives
@thewoolleyman
thewoolleyman / thing_of_the_week.md
Created March 13, 2018 13:36 — forked from lalunamel/thing_of_the_week.md
Thing of the Week blog post

Combating bias and promoting inclusion in the workplace is something we can all agree needs to happen. The question, then, is how?

The way I see it, there are two directions from which change can come: from the top, or from the bottom. Changes from the top come in the form of new HR policies, training, or declarations for more diversity and inclusion work (all of which Pivotal is already doing). Changes from the bottom are a change in culture and a realization that every interaction matters.

What is Thing of the Week?

With