Skip to content

Instantly share code, notes, and snippets.

View trentonstrong's full-sized avatar

Trent Strong trentonstrong

View GitHub Profile
@trentonstrong
trentonstrong / gist:1186969
Created September 1, 2011 19:02
tech interview project
Weight Widget Project
=====================
To get a good example of how you work and approach design and problem solving, we would like you to design and build
for us a relatively simple "weight widget". This document will act as a rough specification for the widget, but you are encouraged
to wear your creative thinking hat. In order to minimize the amount of external requirements for this project, the widget itself
should be built in Javascript and rendered in the browser using the HTML and CSS.
The code can be uploaded to Github or your code repository of choice, as long
as we can be provided access to it to review. The main HTML file of the project should be named index.html, but the rest of the project's
@trentonstrong
trentonstrong / gist:1288140
Created October 14, 2011 20:00
Best thing anyone ever built
require 'chef/knife'
require 'net/ssh'
require 'net/ssh/multi'
require 'readline'
SYMFONY_BIN = "/home/ubuntu/ichange.com/skylight/symfony"
def send_ssh(node, command)
knife_ssh = Chef::Knife::Ssh.new
knife_ssh.config[:identity_file] = "~/ichangekey.pem"
@trentonstrong
trentonstrong / gist:1390212
Created November 23, 2011 23:14
My First Ruby Class
require 'chef/shef/ext'
require 'net/ssh'
require 'net/ssh/multi'
require 'readline'
module IchangeKnifePlugins
PROJECT_HOME = "/home/ubuntu/ichange.com"
SYMFONY_BIN = "#{PROJECT_HOME}/skylight/symfony"
@trentonstrong
trentonstrong / gist:3779646
Created September 25, 2012 02:30
Only 1 failure!
vagrant@lucid32:/vagrant$ arruspekku
..................................................................................................................................................F..................
Failures:
1) omniauth redirects to the specified callback url
Failure/Error: click_button "Allow"
Faraday::Error::ConnectionFailed:
end of file reached
# (eval):3:in `each'
@trentonstrong
trentonstrong / gist:4615548
Created January 23, 2013 23:10
neo4j extension
import org.neo4j.server.rest.web.NodeNotFoundException;
import sun.jvm.hotspot.tools.FinalizerInfo;
//An extension to the Neo4j Server for atomically creating or updating nodes/edges if they already exist.
@Path("/test")
public class AtomicCreateUpdate {
private final UriInfo uriInfo;
private final InputFormat input;
package com.okcupidlabs.neo4j.server.plugins;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
2013-03-07 00:42:10.053+0000 INFO [o.n.s.d.CypherExecutor]: START me=node(32746869)
MATCH me-[:friend]->friend,
friend-[:friend|likes|attending|at|`interested-in`|`active-in`|interacts]->fconnected-[r]->fopent
WITH length(collect(DISTINCT fconnected)) as number, friend, fopent, me
WHERE number > 3 AND NOT friend-->fopent AND NOT me-->fopent
RETURN DISTINCT fopent.name?, fopent, number
ORDER BY number desc
LIMIT 50
2013-03-07 00:42:15.919+0000 INFO [o.n.k.EmbeddedGraphDatabase]: GC Monitor: Application threads blocked for an additional 112ms [total block time: 1486.782s]
2013-03-07 00:42:30.956+0000 INFO [o.n.k.EmbeddedGraphDatabase]: GC Monitor: Application threads blocked for an additional 174ms [total block time: 1486.956s]
{:john-user {:properties {}
:relationships {user-type-node :type-of}}
:john-fb {:properties {:fb-name "who the fuck cares"}
:relationships {:post1 :fb-author-of}}
:jane-fb {:properties {:fb-name "doesn't matter either"}
:relationships {:post2 :fb-author-of}}
:post1 {:properties {}
:relationships {}}
:post2 {:properties {}
:relationships {:post1 :fb-comment}
"START n=node:`entity-type-index`('entity-type:USER')
MATCH n<-[:`type-of`]-opaluser,
opaluser-[:`is-opal-user`]-user,
user-[:`fb-friend`]->friend<-[:`fb-friend`]-person
WHERE NOT id(person)=id(user)
WITH user, person, length(collect(DISTINCT friend)) as number
CREATE UNIQUE user-[r:`fb-mutual-friends`]->person
SET r.`mutual-friends` = number
RETURN DISTINCT user.`fb-name`, user, collect(DISTINCT [person.`fb-name`, r.`mutual-friends`]) as people"
69383 [Thread-66] INFO okcupidlabs.creeper.storm.topology - Crawling connections for crawl-id: 2f6ae6ed-d720-40ba-9f30-05c4bfc34b1b-1367272725589 fb-user: 17151
69404 [Thread-76] DEBUG okcupidlabs.creeper.storm.topology - Upserting connection-type: :events for crawl-id: 2f6ae6ed-d720-40ba-9f30-05c4bfc34b1b-1367272725589 for fb-user: 17130
69405 [Thread-39] DEBUG okcupidlabs.creeper.storm.topology - Upserting connection-type: :events for crawl-id: 2f6ae6ed-d720-40ba-9f30-05c4bfc34b1b-1367272725589 for fb-user: 17130
69434 [Thread-82] DEBUG okcupidlabs.creeper.storm.topology - Upserting connection-type: :events for crawl-id: 2f6ae6ed-d720-40ba-9f30-05c4bfc34b1b-1367272725589 for fb-user: 17130
69464 [Thread-41] DEBUG okcupidlabs.creeper.storm.topology - Upserting connection-type: :events for crawl-id: 2f6ae6ed-d720-40ba-9f30-05c4bfc34b1b-1367272725589 for fb-user: 17130
69474 [Thread-37] DEBUG okcupidlabs.creeper.storm.topology - Upserting connection-type: :events for crawl-id: 2f6ae6ed-d720-40ba-9f30-05