Skip to content

Instantly share code, notes, and snippets.

View danmayer's full-sized avatar

Dan Mayer danmayer

View GitHub Profile
# regarding : http://gist.github.com/157782
# regarding : http://drawohara.com/post/151193800/ruby-symbol-to-hash
#
class Symbol
def to_h(&block)
Hash[to_sym, block && (block.call || eval(to_s, block))]
end
end
# regarding : http://gist.github.com/157782
# regarding : http://drawohara.com/post/151193800/ruby-symbol-to-hash
#
class Binding
def > *vars
vars.flatten.compact.inject({}){|h,v| h.update v => eval(v.to_s, self)}
end
end
# regarding : http://gist.github.com/157782
# regarding : http://drawohara.com/post/151193800/ruby-symbol-to-hash
#
class Binding
def map *vars
vars.flatten.compact.inject({}){|h,v| h.update v => eval(v.to_s, self)}
end
alias_method '>', 'map'
end
@mndoci
mndoci / iam_fog.rb
Created May 29, 2011 03:48 — forked from zapnap/iam_fog.rb
Using Amazon IAM with Fog (example)
# via http://blog.zerosum.org/2011/03/02/better-aws-access-control-with-iam-and-fog.html
require 'fog'
username = 'testuser'
bucket = 'uniquebucketname1234'
aws_credentials = {
:aws_access_key_id => 'YOUR-ACCESS-KEY-ID',
:aws_secret_access_key => 'YOUR-SECRET-ACCESS-KEY'
@rowan-m
rowan-m / gist:1026918
Created June 15, 2011 11:34 — forked from jedi4ever/gist:898114
update jenkins Updatecenter from CLI
$ java -jar jenkins-cli.jar -s http://localhost:9000 install-plugin findbugs
findbugs is neither a valid file, URL, nor a plugin artifact name in the update center
No update center data is retrieved yet from: http://updates.jenkins-ci.org/update-center.json
findbugs looks like a short plugin name. Did you mean 'null'?
# Specifying a full URL works!
$ java -jar jenkins-cli.jar -s http://localhost:9020 install-plugin http://updates.jenkins-ci.org/download/plugins/AdaptivePlugin/0.1/AdaptivePlugin.hpi
# Get the update center ourself
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active May 3, 2024 16:53
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@MrJoy
MrJoy / git_ls_files.rb
Created October 10, 2012 22:42
A VERY partial implementation of .gitignore semantics in Ruby...
#!/usr/bin/env ruby
require 'set'
# This code is meant to demonstrate the difficulty of actually applying .gitignore semantics manually. It supports a key subset of .gitignore
# behaviors, including:
# * Anchored and unanchored patterns/globs.
# * Un-ignoring of patterns/globs, with the same quirky semantics as git.
# * Escaping a leading hash in a pattern.
# * User-wide exclusion list.
# * Top-of-repo .gitignore.
def run!
pid = fork do
exec_pid = fork do
$0 = "heaven[#{Heaven.current_sha}] : executing deployment of #{application_name}"
out_file = File.new(log, "w")
STDIN.reopen("/dev/null")
STDOUT.reopen(out_file)
STDERR.reopen(out_file)

Make it real

Ideas are cheap. Make a prototype, sketch a CLI session, draw a wireframe. Discuss around concrete examples, not hand-waving abstractions. Don't say you did something, provide a URL that proves it.

Ship it

Nothing is real until it's being used by a real user. This doesn't mean you make a prototype in the morning and blog about it in the evening. It means you find one person you believe your product will help and try to get them to use it.

Do it with style

@dorkalev
dorkalev / a start
Last active December 23, 2015 08:29
sentence = "there is a wild rose"
letters = sentence.gsub(' ','').split(//)