Skip to content

Instantly share code, notes, and snippets.

@teeparham
teeparham / aws-ses.rb
Created February 11, 2011 21:57
AWS SES - with display from
gem install aws-ses
# in irb:
require 'aws/ses'
ses = AWS::SES::Base.new :access_key_id => "your-key",
:secret_access_key => "your-secret-key"
ses.addresses.list.result
@markbates
markbates / date_time.coffee
Created May 11, 2011 19:07
Example: Rails-style date/time helpers in CoffeeScript
Number::seconds = ->
@ * 1000
Number::minutes = ->
@seconds() * 60
Number::minute = Number::minutes
Number::hours = ->
@minutes() * 60
@mattsgarrison
mattsgarrison / date_time.coffee
Created December 28, 2011 16:07 — forked from markbates/date_time.coffee
Example: Rails-style date/time helpers in CoffeeScript (added days)
Number::seconds = ->
@ * 1000
Number::minutes = ->
@seconds() * 60
Number::minute = Number::minutes
Number::hours = ->
@minutes() * 60
@gavingmiller
gavingmiller / dump.m
Created June 11, 2012 14:43
Objective-C Dump Views
static void dumpViews(UIView* view, NSString *text, NSString *indent)
{
Class cl = [view class];
NSString *classDescription = [cl description];
while ([cl superclass])
{
cl = [cl superclass];
classDescription = [classDescription stringByAppendingFormat:@":%@", [cl description]];
}
@bbrowning
bbrowning / TorqueBox on Heroku.md
Last active December 9, 2015 16:19
TorqueBox on Heroku

With Heroku's JRuby support you may have already seen that you can run TorqueBox Lite on Heroku. But, that only gives you the web features of TorqueBox. What about scheduled jobs, backgroundable, messaging, services, and caching?

With a small amount of extra work, you can now run the full TorqueBox (minus STOMP support and clustering) on Heroku as well! I've successfully deployed several test applications, including the example Rails application from our Getting Started Guide which has a scheduled job, a service, and uses backgroundable and messaging.

This example uses TorqueBox 3.0.2, but the instructions may work with other TorqueBox versions.

Steps Required

  1. Create a JRuby application on Heroku, or convert an existing application to JRuby. Make sure your application works on JRuby on Heroku before throwing TorqueBox into the mix.
  2. Add th
@linickx
linickx / gist:3692156
Created September 10, 2012 17:01
hubot init script for RHEL / CENTOS
#!/bin/bash
# hubot
# chkconfig: 345 20 80
# description: hubot
# processname: hubot
# REFERENCE: http://werxltd.com/wp/2012/01/05/simple-init-d-script-template/
# This script assumes you have a user called "hubot" on your system and that hubot is installed in /opt/hubot
@gordonkristan
gordonkristan / FIRST.md
Last active May 11, 2018 21:53
Ember.js Optional Route Parameters

Ember.js Optional Route Parameters

A topic that comes up quite often in Ember.js discussion forums is optional route parameters. Unfortunately for those who have this problem, there's no built-in way to achieve this functionality. But there is a very nice little hack that will emulate optional route parameters for most sitautions. The actual method is pretty simple, it just requires combining a few tricks. I'll describe the high-level deatils here, and you can find working example code below.

What's needed to pull this off:

  1. You'll need a resource with a sub-route. The sub-route is the 'real' route that you're going to use. All of your logic should be declared in the controller and template for this route. (Also remember that using a resource generates an implicit index route.)
  2. The implicit index route is where you should redirect to if you have no model to provide. It's also where you end up if you go to a URL without providing the parameter. This route immediately redirects to your other sub-r
@seanlilmateus
seanlilmateus / gist:3745223
Created September 18, 2012 19:22
hash AR style for rubymotion
class User
attr_accessor :id, :name, :email
def initialize(dictionary = {})
setValuesForKeysWithDictionary(dictionary) if dictionary.is_a?(Hash)
end
def setValue(value, forUndefinedKey:key); end
end
@jodosha
jodosha / adapter_test.rb
Last active August 11, 2019 03:12
MiniTest shared examples
require 'test_helper'
shared_examples_for 'An Adapter' do
describe '#read' do
before do
@adapter.write(@key = 'whiskey', @value = "Jameson's")
end
it 'reads a given key' do
@adapter.read(@key).must_equal(@value)
@Dev-Dipesh
Dev-Dipesh / go-redis-amz-ami.md
Last active June 24, 2020 20:33
Golang and Redis Setup on Amazon 64 bit AMI Linux

Update Server

sudo yum -y update
sudo yum -y install gcc make

Golang Installation

Download Go binary