Skip to content

Instantly share code, notes, and snippets.

View carols10cents's full-sized avatar

Carol (Nichols || Goulding) carols10cents

View GitHub Profile
@mig
mig / minispec.rb
Created October 31, 2010 21:28
I want to use minitest in a Rails project with spec like syntax (work in progress)
class Object
cattr_accessor :current_test
end
module Minispec
class TestClass
def self.prepare(desc)
name = name_for_class(desc)
Class.new(base_test_class(name)) do
define_singleton_method(:name) { name }
@tenderlove
tenderlove / person_test.rb
Created February 10, 2011 23:10
Use minitest/spec with Rails 3
require 'test_helper'
require 'minitest/autorun'
class MiniTest::Spec
include ActiveSupport::Testing::SetupAndTeardown
include ActiveRecord::TestFixtures
alias :method_name :__name__ if defined? :__name__
self.fixture_path = File.join(Rails.root, 'test', 'fixtures')
end
@coreyhaines
coreyhaines / .rspec
Last active April 11, 2024 00:19
Active Record Spec Helper - Loading just active record
--colour
-I app
@steveklabnik
steveklabnik / http.rb
Created March 24, 2012 20:27
A Shoes hypermedia client for ALPS microblogging
require 'net/http'
require 'open-uri'
require 'hpricot'
# A simple get request should not require this much boilerplate.
def fetch_data(uri)
uri = URI(uri)
req = Net::HTTP::Get.new(uri.request_uri)
req['Accept'] = "application/xhtml+xml"
@justincampbell
justincampbell / scrc-day1.md
Created August 3, 2012 21:49
Steel City Ruby Conf 2012

Getting the most out if a Conference - Jeff Casimir

Why are we here? Ruby community is awesome New people are awesome Developers are exhausted by social interaction Recharge with a movie by yourself Conferences are about starting conversation Its hard Introvert != shy

@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@brobertsaz
brobertsaz / serversetup.md
Last active July 6, 2020 08:56
Ubuntu 12.04 Ruby, Rails, Nginx, Unicorn

Ubuntu 12.04, Ruby, Rails, Nginx, Unicorn and git-deploy

In the seemlingly endless search for the actual correct and easy way to deploy a Rails app, we have tried several ways. We tried out using Apache2 and running a cluster of Thin servers. With the built in threading of Puma we decided to use it with Nginx.

Server Setup

  • Create new server
  • Login to new server
    • ssh root@IPaddress (you can also use the domain name if you have the DNS setup already)
    • accept the RSA key
@xaviershay
xaviershay / rewrite.rb
Created January 10, 2013 06:11
Proof-of-concept squid proxy settings for proxying http://rubygems.org/ Tested on one project on my local machine both cold, and warm with internet turned off.
#!/usr/bin/env ruby
# url rewriter for rubygems squid proxy
STDOUT.sync = true
while line = gets
url = line.split(' ')[0]
# Cargo-culted this conditional, not sure if it is necessary
response = if url
@pvh
pvh / gist:4634543
Last active December 11, 2015 17:28
Postgres: The Bits You Haven't Found talk
A Beastiary of Badassery
-
SQLisms
--
WITH
arrays and unnest
window functions
JSON
row types
@carols10cents
carols10cents / gist:6049798
Created July 21, 2013 20:12
Slim 2.0 deprecation warnings
# How to find files that have spaces around attribute delimiters
git ls-files *.slim* | xargs -I {} slimrb -c {} | grep "spaces around attribute delimiters"