Skip to content

Instantly share code, notes, and snippets.

View joshwand's full-sized avatar

Josh Wand joshwand

  • San Francisco, CA
View GitHub Profile
@joshwand
joshwand / onion.ipynb
Last active August 7, 2024 17:19
New Method for Dicing an Onion
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/bin/bash
set -e
set -x
COLLECTOR_IP=${COLLECTOR_IP:-127.0.0.1}
COLLECTOR_TCP_PORT=${COLLECTOR_TCP_PORT:-9994}
COLLECTOR_UDP_STAT_LISTEN_PORT=${COLLECTOR_UDP_STAT_LISTEN_PORT:-9995}
COLLECTOR_UDP_SPAN_LISTEN_PORT=${COLLECTOR_UDP_SPAN_LISTEN_PORT:-9996}
@joshwand
joshwand / com.twitter.user.js
Created July 19, 2016 19:19 — forked from matthewlmcclure/com.twitter.user.js
Load new tweets automatically.
(function() {
// ==UserScript==
// @name Load new tweets automatically.
// @namespace http://matthewlmcclure.com
// @match https://twitter.com/*
// ==/UserScript==
var updating = true;
var event = document.createEvent('MouseEvents');
@joshwand
joshwand / nested_attributes_associate_existing_record.patch
Last active December 18, 2015 14:08
activerecord patch (doesn't work!)
diff --git a/activerecord/lib/active_record/nested_attributes.rb b/activerecord/lib/active_record/nested_attributes.rb
index e53e855..3f27a34 100644
--- a/activerecord/lib/active_record/nested_attributes.rb
+++ b/activerecord/lib/active_record/nested_attributes.rb
@@ -480,6 +480,13 @@ module ActiveRecord
if !call_reject_if(association_name, attributes)
assign_to_or_mark_for_destruction(existing_record, attributes, options[:allow_destroy])
end
+ elsif association.klass.exists?(attributes['id'])
+ if !call_reject_if(association_name, attributes)
@joshwand
joshwand / tumblr-likes-downloader.rb
Last active June 28, 2024 14:24
download your liked photos from tumblr
require 'tumblr_client'
require 'mechanize'
require 'date'
require 'yaml'
require 'uri'
Tumblr.configure do |config|
config.consumer_key = "consumer_key"
config.consumer_secret = "consumer_secret"
config.oauth_token = "oath_token"
@joshwand
joshwand / gist:4170537
Created November 29, 2012 17:22
disqus digests unsubscribe fiail
1. make sure you're logged out of disqus
2. click unsusbscribe link in digests email ("http://disqus.com/dashboard/#notifications")
expected results: I am unsubscribed from digest email
actual results: login screen with empty! notifications panel overlaid: http://d.pr/i/WJ30
3. login to disqus
expected results: I am unsubscribed from digest email
actual results: disqus dashboard
@joshwand
joshwand / gist:1145669
Created August 15, 2011 03:41
Blocking the new version of the NYTimes paywall

The NYTimes has updated their paywall-- it's slightly more sophisticated. The content is no longer hidden behind a big transparent div, but instead is now actually removed from the page entirely. It's still simple to defeat, though. Using adblock plus (or your preferred adblocking device), block the following URLs:

*://*.nytimes.com/*/gwy.js*
*://*.nytimes.com/*/gw.js*

And you're done.

@joshwand
joshwand / gist:1074244
Created July 10, 2011 03:53
How to fix "libiconv is missing" problem installing Nokogiri on 10.6 with MacPorts

When installing Nokogiri on 10.6 with macports, the build fails because libiconv is missing:


Building native extensions.  This could take a while...
ERROR:  Error installing nokogiri:
       ERROR: Failed to build gem native extension.

/Users/jmacdonald/.rvm/rubies/ruby-1.8.7-p174/bin/ruby extconf.rb
checking for libxml/parser.h... yes
@joshwand
joshwand / What Killed Waterfall could Kill Agile.textile
Created November 22, 2010 23:50
What Killed Waterfall Could Kill Agile.

ganked from unreadable scribd doc here: http://cleancoder.posterous.com/what-killed-waterfall-could-kill-agile

What Killed Waterfall could Kill Agile.

Robert C. Martin
20 Nov, 2010

In 1970 a software engineer named Dr. Winston W. Royce wrote a seminal paper entitled Managing the Development of Large Software Systems. This paper described the software process that Royce felt was appropriate for large-scale systems. As a designer for the Aerospace industry, he was uniquely qualified.

He began the paper by setting up a straw-man process to knock down. He described this naïve process as “grandiose”. He depicted it with a simple diagram on an early page of his paper. Then the paper methodically tears this “grandiose” process apart. In the end, Royce proposed a far more nuanced and insightful approach, leaving the reader to giggle at the silliness of the “grandiose” model.

@joshwand
joshwand / yajl streaming testcase 2
Created March 3, 2010 17:42
httparty/yajl streaming testcase 2
require 'rubygems'
require 'httparty'
require 'uri'
class HttpPartyTest
def do_httparty_request
p HTTParty.get("http://whoismyrepresentative.com/whoismyrep.php?zip=46544")
end