Skip to content

Instantly share code, notes, and snippets.

View c4milo's full-sized avatar
:octocat:

Camilo Aguilar c4milo

:octocat:
View GitHub Profile
// GetByID returns an Account instance given its id which is either:
// username or email.
func (r *RepoPostgres) GetByID(id string) (*Account, error) {
a := new(account)
err := r.db.Get(a, "SELECT * FROM accounts WHERE username = $1 OR email = $1", id)
if err != nil {
return nil, translateError(err)
}
a.Account.PictureURL, _ = url.Parse(a.PictureURL)
#!/bin/bash
for branch in `git branch -a | grep remotes | grep -v HEAD | grep -v master`; do
name=`echo "$branch" | sed 's|remotes/origin/||'`
git branch --track "${name}" "$branch"
done
// Package mailer wraps Mandrill's REST API only for sending emails using templates.
package mailer
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
git log --pretty="format:%an %ae" | sort | uniq -i | sort | sed -e 's/^ *[0-9]* //g' > AUTHORS
package main
import "log"
var i int
func bsearch(target int, array []int) int {
low := 0
hi := len(array)
camilo@levitas:~/Development/ruby/cucumber/examples/selenium_webrat$ rake features
(in /home/camilo/Development/ruby/cucumber/examples/selenium_webrat)
/usr/bin/ruby1.8 -I "/home/camilo/Development/ruby/cucumber/lib:lib" "/home/camilo/Development/ruby/cucumber/bin/cucumber" --format pretty --require features/step_definitons/search_steps.rb --require features/support/env.rb features/search.feature
Feature: Search
In order to learn more
As an information seeker
I want to find more information
Scenario: Find what I'm looking for # features/search.feature:6
==> Waiting for Selenium RC server on port 4444... .
20:36:02.868 ERROR - Failed to start new browser session, shutdown browser an clear all session data
org.openqa.selenium.server.RemoteCommandException: timed out waiting for window 'null' to appear
at org.openqa.selenium.server.FrameGroupCommandQueueSet.waitForLoad(FrameGroupCommandQueueSet.java:565)
at org.openqa.selenium.server.FrameGroupCommandQueueSet.waitForLoad(FrameGroupCommandQueueSet.java:522)
at org.openqa.selenium.server.BrowserSessionFactory.createNewRemoteSession(BrowserSessionFactory.java:324)
at org.openqa.selenium.server.BrowserSessionFactory.getNewBrowserSession(BrowserSessionFactory.java:118)
at org.openqa.selenium.server.BrowserSessionFactory.getNewBrowserSession(BrowserSessionFactory.java:81)
at org.openqa.selenium.server.SeleniumDriverResourceHandler.getNewBrowserSession(SeleniumDriverResourceHandler.java:658)
at org.openqa.selenium.server.SeleniumDriverResourceHandler.doCommand(SeleniumDriverResourceHandler.java:392)
at org.openqa.selenium.server.SeleniumDriverResourceHandler.han
camilo@levitas:~/Development/ruby/cucumber/examples/selenium_webrat$ rake features
(in /home/camilo/Development/ruby/cucumber/examples/selenium_webrat)
/usr/bin/ruby1.8 -I "/home/camilo/Development/ruby/cucumber/lib:lib" "/home/camilo/Development/ruby/cucumber/bin/cucumber" --format pretty --require features/step_definitons/search_steps.rb --require features/support/env.rb features/search.feature
Feature: Search
In order to learn more
As an information seeker
I want to find more information
Scenario: Find what I'm looking for # features/search.feature:6
==> Waiting for Selenium RC server on port 4444... .
camilo@levitas:~/Development/ruby/cucumber/examples/selenium_webrat$ rake features
(in /home/camilo/Development/ruby/cucumber/examples/selenium_webrat)
Feature: Search
In order to learn more
As an information seeker
I want to find more information
Scenario: Find what I'm looking for # features/search.feature:6
==> Waiting for Selenium RC server on port 4444... .
.
require 'singleton'
class Configuration
include Singleton
def initialize
config_file = File.join(RAILS_ROOT, "config", "application.yml")
if File.exists?(config_file)
config = YAML.load(File.read(config_file))[RAILS_ENV]