Skip to content

Instantly share code, notes, and snippets.

View deepthawtz's full-sized avatar
👩‍🎤
singin'

Dylan Clendenin deepthawtz

👩‍🎤
singin'
  • Venmo
  • San Francisco, CA
View GitHub Profile
@deepthawtz
deepthawtz / sym_to_proc_vs_regular_block_with_arguments.rb
Created May 29, 2011 02:18
Symbol.to_proc vs. regular block with arguments
require "benchmark"
n = 1_000_000
Benchmark.bm do |x|
x.report("symbol to proc ") { Array.new(n, "45").map(&:to_i) }
x.report("regular block with args") { Array.new(n, "45").map {|i| i.to_i} }
end
@deepthawtz
deepthawtz / rational_test2.cpp
Created March 20, 2011 23:14
tests for school assignment
#include <iostream>
#include <cassert>
using namespace std;
#include "Rational.h"
int main()
{
Rational c(7,3), d(3,9), x;
// test == and != operator
@deepthawtz
deepthawtz / rational_test.cpp
Created March 20, 2011 05:00
some school stuff
// **************************************************************************
// * Author: Dylan Clendenin *
// **************************************************************************
#include <iostream>
#include <cassert>
using namespace std;
#include "Rational.h"
%w[
open-uri
nokogiri
mongo
].map { |x| require x }
db = Mongo::Connection.new.db("tennis_network")
Courts = db.collection("courts")
Courts.create_index([["state", Mongo::ASCENDING]])
☂ ~ ps aux | grep ruby
deepthawtz 46543 51.7 0.2 2471504 17672 ?? S 12:38AM 3:04.06 ruby tennis_scrape.rb
deepthawtz 46639 0.0 0.0 2425524 172 s003 R+ 12:44AM 0:00.00 grep ruby
☂ ~ sudo kill 46543
☂ ~ ps aux | grep ruby
deepthawtz 46543 52.0 0.2 2471504 17672 ?? S 12:38AM 3:10.20 ruby tennis_scrape.rb
deepthawtz 46647 0.0 0.0 2425716 280 s003 R+ 12:44AM 0:00.00 grep ruby
☂ ~ sudo killall ruby
☂ ~ ps aux | grep ruby
deepthawtz 46543 51.3 0.2 2471504 17672 ?? R 12:38AM 3:20.79 ruby tennis_scrape.rb
var YUI = require("yui3").YUI
, otherSuite = require("./other_suite")
;
YUI({logInclude:{TestRunner:true}}).use("test", function(Y) {
var suite = new Y.Test.Suite("Server Test Suite");
var test_nothing = new Y.Test.Case({
name: "Testing nothing",
"testing nothing special": function() {
@deepthawtz
deepthawtz / yql.js
Created November 11, 2010 22:22
didn't really know YQL was this awesome
// example runs in node.js
// npm install yui3
var sys = require("sys")
, YUI = require("yui3").YUI
;
YUI().use("gallery-yql", function(Y) {
var q = "select * from github.user.info where (id = 'deepthawtz')"
, o = new Y.yql(q)
get with it dawg
[Fri, 17 Sep 2010 16:58:49 -0700] DEBUG: STDERR: /home/deploy/.bundle/ruby/1.8/gems/actionpack-2.3.5/lib/action_controller/session/mem_cache_store.rb:20:in `initialize': #<ActionController::Session::MemCacheStore:0xb6cf0038> unable to find server during initialization. (RuntimeError)
from /home/deploy/.bundle/ruby/1.8/gems/actionpack-2.3.5/lib/action_controller/middleware_stack.rb:72:in `new'
from /home/deploy/.bundle/ruby/1.8/gems/actionpack-2.3.5/lib/action_controller/middleware_stack.rb:72:in `build'
from /home/deploy/.bundle/ruby/1.8/gems/actionpack-2.3.5/lib/action_controller/middleware_stack.rb:116:in `build'
from /home/deploy/.bundle/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/inflector.rb:361:in `inject'
from /home/deploy/.bundle/ruby/1.8/gems/actionpack-2.3.5/lib/action_controller/middleware_stack.rb:116:in `each'
from /home/deploy/.bundle/ruby/1.8/gems/actionpack-2.3.5/lib/action_controller/middleware_stack.rb:116:in `inject'
from /home/deploy/.bundle/ruby/1.8/gems/actionpack-2.3.5/l
require "dnapi"
run "sudo cp /etc/chef/dna.json /tmp/dna.json && sudo chmod 777 /tmp/dna.json && sync"
def engineyard
@engineyard ||= DNApi.from(File.read("/tmp/dna.json"))
end
b=engineyard.environment.utility_instances.find {|x| x.name.include? "redis"}
engineyard.apps.each do |app|
begin
run "echo host: #{b.public_hostname} > /data/#{app.name}/current/config/redis.yml"
rescue