Skip to content

Instantly share code, notes, and snippets.

View ahoward's full-sized avatar
💭
probably outside if i'm not hacking.

ara.t.howard ahoward

💭
probably outside if i'm not hacking.
View GitHub Profile
#! /usr/bin/env ruby
# this program (on osx and probably others) will give you a 'named screen'
# (ns) command that will create named screens that will also name Terminal.app
# tabs, even on re-attach. save it in ~/bin/ns and use as in
#
# to create a named screen
#
# ns ~/src/foobar
#
DEBUG [ea842735] Running /usr/bin/env pwd as [email protected]
DEBUG [ea842735] Command: cd /ebs/apps/fbomb-daemon/current && ( export PATH="./bin:/usr/local/rbenv/shims:/usr/local/rbenv/bin:/usr/local/mongo/bin:/usr/local/bin:/usr/bin:/bin:/sbin:/usr/sbin:$PATH" ; /usr/bin/env pwd )
DEBUG [ea842735] /ebs/apps/fbomb-daemon/releases/20151202210221
DEBUG [ea842735] Finished in 0.093 seconds with exit status 0 (successful).
/ebs/apps/fbomb-daemon/releases/20151202210221
DEBUG [422d9321] Running /usr/bin/env ls -l /ebs/apps/fbomb-daemon/current/dotdir as [email protected]
DEBUG [422d9321] Command: ls -l /ebs/apps/fbomb-daemon/current/dotdir
DEBUG [422d9321] total 16
-rw-rw-r-- 1 dojo4 dojo4 10683 Dec 2 20:51 commands.rb
-rw-rw-r-- 1 dojo4 dojo4 754 Dec 2 20:51 commands.yml
@ahoward
ahoward / a.rb
Created November 10, 2015 23:33
model =
SomeActiveRecordModel
conditions =
[
# ...
]
cache_key =
@ahoward
ahoward / a.eml
Created August 31, 2015 23:04
one of the first ruby meetup's in boulder
Return-Path: <[email protected]>
X-Original-To: [email protected]
Delivered-To: [email protected]
Received: from harp.ngdc.noaa.gov (harp.ngdc.noaa.gov [140.172.178.33])
by planchet.hinegardner.org (Postfix) with ESMTP id A5B4E1599A58
for <[email protected]>; Thu, 9 Jun 2005 19:06:06 -0600 (MDT)
Received: from harp.ngdc.noaa.gov (harp.ngdc.noaa.gov [127.0.0.1])
by harp.ngdc.noaa.gov (8.12.11/8.12.11) with ESMTP id j5A00sqp018449;
Thu, 9 Jun 2005 18:00:54 -0600
Received: from localhost (ahoward@XXXXXXXXXX
@ahoward
ahoward / a.rb
Created July 21, 2015 21:25
the caseless case.
@debug =
case
when ENV['IANDA_DEBUG']
!!ENV['IANDA_DEBUG']
when !Rails.env.production?
Rails.logger
end
@ahoward
ahoward / a.rb
Last active August 29, 2015 14:20
hash rockets are more beautiful than colon-oscopies
segment = Segment::TwitterFollowers.create(
name: "Demo Twitter Followers Segment #{ timestamp }",
account: account,
client: client,
definition_data: "@nike\n"
)
VS
@ahoward
ahoward / a.rb
Created May 6, 2015 00:32
dynamic glob-y routes where the glob will be know inside the action's params
Webhook.subclasses.each do |subclass|
type = subclass.type
match(
"webhooks/:id/#{ type }(/:context_id)(.:format)",
:controller => "webhooks",
:action => "call",
:type => type
)
end
@ahoward
ahoward / asset.rb
Created April 26, 2015 18:38
lib/asset.rb - minimal way of interfacing with a cdn that can store files and process them on the fly - in this case cloudinary, but applicable to others
# you should rely ONLY in the class leve interface in your views, aka
#
# Asset.thumbnail(path, :dimensions => '42x42').url
# Asset.bw(path).url
#
# and no lib internals for now - this is under development
#
# this lib handles a few things in a simple interface. highlights:
#
# - file ids are md5s of the file contents
@ahoward
ahoward / a.rb
Created April 19, 2015 14:35
reliably construct a bucket residing in any region with ruby ruby aws-sdk v1
[a, b].each do |bucket_name|
bucket = AWS::S3.new.buckets[bucket_name]
location_constraint = bucket.location_constraint
s3_endpoint = location_constraint.blank? ? "s3.amazonaws.com" : "s3-#{ location_constraint }.amazonaws.com"
bucket = AWS::S3.new(:s3_endpoint => s3_endpoint).buckets[bucket_name]