# get your own login
query {
viewer {
login
}
}
List the organizations for a user:
# get your own login
query {
viewer {
login
}
}
List the organizations for a user:
we use the ro gem
https://github.com/ahoward/ro
a-2:~/git/dojo4/www $ ls public/ro/
chiclets pages people posts
@tenderlove asked "Is it good to teach RSpec (vs t/u) to people who are totally new to Ruby?" I have experience suggesting that it is a good thing; after a short back and forth, it seemed useful to write it up in detail.
This goes back several years, to when I was the primary Ruby/Rails trainer for Relevance from 2006-2009. I'm guessing that worked out to probably 6-8 classes a year during those years. Since then, RSpec has changed a fair amount (with the addition of expect
) and test/unit has changed radically (it has an entirely new implementation, minitest, that avoids some of the inconsistencies that made test/unit a bit confusing during the time I'm writing about here).
I started out as an RSpec skeptic. I've never been afraid of what a lot of people denigrate as "magic" in Ruby libraries … to me, if you take the trouble to understand it, that stuff's just pr
function silencing_stderr() { | |
$* 2>/dev/null | |
} | |
function branch_names() { | |
git br | awk '{print $1}' | grep -v '*' | xargs | |
} | |
function most_recent_commit() { | |
git log . | grep "Date: " | cut -c 9- | head -1 |
# An idea on how to sort and filter Ruby collections in a functional | |
# style | |
# Just using Struct for convenience, this could be a normal class. | |
User = Struct.new(:first_name, :last_name, :admin) do | |
def self.sort_by_name | |
# Define a new sort | |
lambda do |x,y| | |
# last name, first name DESC |
sentence = "there is a wild rose" | |
letters = sentence.gsub(' ','').split(//) |
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.
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.
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) |
#!/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. |
-- 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%' |