This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# at_authlogic_basic_setup.rb | |
# | |
# See also: | |
# http://m.onkey.org/2008/12/4/rails-templates | |
# http://www.binarylogic.com/2008/11/3/tutorial-authlogic-basic-setup | |
# 1. Install Authlogic | |
plugin "authlogic", :git => "git://github.com/binarylogic/authlogic.git" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Potential solution to "Using accepts_nested_attributes_for with a belongs_to association, and using find_or_create_by_attr behaviour" | |
# http://stackoverflow.com/questions/2970255/using-accepts-nested-attributes-for-with-a-belongs-to-association-and-using-find | |
class Upload < AR:B | |
belongs_to :user | |
belongs_to :observed_property | |
belongs_to :sensor | |
attr_accessor :observed_property_attributes, | |
:sensor_attributes | |
attr_accessible :observed_property_attributes, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# PROBLEM: when someone replies to you publicly in an IRC channel you may not be | |
# notified of it if you are away from your computer. The common format for public | |
# replies looks like this: | |
# | |
# <jchris> maxo_: yeah mine is way better | |
# | |
# SOLUTION: Sign up for notifo as both a supplier and a consumer, and install the | |
# notifo app on your smartphone. Execute this in cron every minute to have new | |
# mentions sent to your phone as push notifications. | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Enable upload_progress module for easy cross browser progress bar support | |
# using only javascript client side | |
upload_progress foobar_uploads 1m; | |
server { | |
# We only need one server block to deal with HTTP and HTTPS | |
# avoids duplication | |
listen 80; | |
listen 443 default ssl; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ~/.tmux.conf | |
# | |
# See the following files: | |
# | |
# /opt/local/share/doc/tmux/t-williams.conf | |
# /opt/local/share/doc/tmux/screen-keys.conf | |
# /opt/local/share/doc/tmux/vim-keys.conf | |
# | |
# URLs to read: | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# === In capistrano stage config (config/deploy/staging.rb, et al.) | |
set :deployed_url, 'https://paydici.com' | |
# Pivotal Tracker | |
set :pivotal_project_id, 39238 | |
set :pivotal_token, 'OMG SEEKRIT TOKEN' | |
set :deliver_when_deploying_to, [:live,:dev] | |
before "deploy", "deploy:gather_information" | |
after "deploy", "deploy:tag_pivotal_stories", "deploy:summarize" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Parser = require('./jsonparse'); | |
var Http = require('http'); | |
var p = new Parser(); | |
// IMPORTANT, put your username and password in here | |
var username = "yourTwitterUsername", password = "yourPassword"; | |
var client = Http.createClient(80, "stream.twitter.com"); | |
var request = client.request("GET", "/1/statuses/sample.json", { | |
"Host": "stream.twitter.com", | |
"Authorization": (new Buffer(username + ":" + password)).toString("base64") | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Given /^I expect to pay \$(\d+) via amazon$/ do |arg1| | |
price = arg1.to_f | |
mock_pipeline_request = mock('pipeline_request', | |
:url => sekret_payment_path(:transaction_amount => price)) | |
Remit::API.any_instance. | |
expects(:get_recurring_use_pipeline). | |
with{ |opts| opts[:transaction_amount] == price }. | |
returns(mock_pipeline_request) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'faraday' | |
require 'net/http' | |
require 'pp' | |
# Repos: | |
# https://github.com/technoweenie/faraday | |
# https://github.com/pengwynn/faraday_middleware | |
# Blog posts: | |
# http://adventuresincoding.com/2010/09/writing-modular-http-client-code-with-faraday |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def tip(msg); puts; puts msg; puts "-"*100; end | |
# | |
# 30 Ruby 1.9 Tips, Tricks & Features: | |
# http://www.igvita.com/2011/02/03/new-ruby-19-features-tips-tricks/ | |
# | |
tip "Upgrading to Ruby 1.9 is simple: rvm install 1.9.2 && rvm --default 1.9.2" | |
tip "Ruby 1.9 supports named captures in regular expressions!" |
OlderNewer