Skip to content

Instantly share code, notes, and snippets.

View afeld's full-sized avatar

Aidan Feldman afeld

View GitHub Profile
@afeld
afeld / gist:4725026
Last active December 12, 2015 05:49 — forked from robreuss/gist:4725007
{
"multiquark": {
"quarks": [
{
"background_picture": {
"id": "5112ac3d94b23b743c00001e"
},
"text": "First Page",
"title": "stuff"
},
@afeld
afeld / gist:4539970
Last active December 11, 2015 03:48
Jux: emails from Airbrake
# We had introduced a bug that was causing user registration errors in Rails for certain email addresses.
# Fetch the list of unique emails that had failed registration (that produced a particular exception).
require 'open-uri'
require 'nokogiri'
require 'set'
AUTH_TOKEN = 'XXX'
ERROR_ID = '54425478'
@afeld
afeld / deploy1.txt
Created November 7, 2012 07:54
Nodejitsu deployment problem
➜ jsonp git:(master) ✗ jitsu deploy
info: Welcome to Nodejitsu aidanfeldman
info: jitsu v0.10.5, node v0.8.11
info: It worked if it ends with Nodejitsu ok
info: Executing command deploy
info: Analyzing application dependencies in server.js
debug: { method: 'GET',
debug: uri: 'http://api.nodejitsu.com/apps/aidanfeldman/jsonp',
debug: headers:
debug: { Authorization: 'Basic YWlkYW5mZWxkbWFuOmN1YmJpZTE=',
@afeld
afeld / _setup.txt
Last active September 13, 2022 18:34
Seven Languages in Seven Months: Ruby presentation
git clone git://gist.github.com/3944262.git seven_langs_ruby
cd seven_langs_ruby
gem install gli -v 1.6.0
gem install showoff
showoff serve
open "http://localhost:9090"
@afeld
afeld / results.md
Last active October 11, 2015 15:08
Jux Video Dimensions

Dimensions of Videos on Jux Dimensions of Videos on Jux by Service Most Common Video Dimensions on Jux

@afeld
afeld / gist:3620993
Created September 4, 2012 13:07
test for finding cluster in SQL graph
DROP TABLE IF EXISTS profile_matches;
DROP TABLE IF EXISTS profiles;
-- the "nodes"
CREATE TABLE profiles (
id SERIAL PRIMARY KEY,
service text,
username text
);
@afeld
afeld / gist:3549307
Created August 31, 2012 05:18
upgrading to Mountain Lion
# run Apple's Software Update
# open XCode, then XCode(menu)->Preferences->Downloads tab and Install the Command Line Tools
brew update
brew doctor
# follow any instructions - mine are included below
brew tap homebrew/dupes
brew install autoconf automake apple-gcc42
brew link apple-gcc42 # for some reason this didn't work in prior step
@afeld
afeld / countdown.js
Created August 18, 2012 17:23
Corsonus countdown
var startTimeInterval = setInterval(function(){
jQuery.getJSON('http://api.corsonus.com/start.json?callback=?', function(data){
var startTime = data.start_time;
if (startTime){
clearInterval(startTimeInterval);
console.log('counting down...');
var countdownInterval = setInterval(function(){
// number of seconds
var remaining = Math.round((startTime - Date.now()) / 1000);
console.log('number of seconds remaining: ' + remaining);
@afeld
afeld / gist:3364792
Created August 15, 2012 23:47
Jux: clean up garbage Twitter usernames
# using Mongoid
# clean up leading/trailing whitespace
User.where(twitter_username: /(\A\s+[A-Za-z0-9_]+\s*\z)|(\A\s*[A-Za-z0-9_]+\s+\z)/).each do |user|
user.twitter_username = user.twitter_username.strip
user.save!
end
# clean up twitter usernames of the format @... or twitter.com/...
link_rx = /(?:\A@|\A\/|twitter\.com\/(?:#!\/)?)([A-Za-z0-9_]+)\s*\z/i
@afeld
afeld / gist:3074251
Created July 9, 2012 04:49
Jux: import Instagram photos for a user
user = User.find_by_username('catturner')
user_id = user.id
next_max_id = nil
quark_ids = []
picture_ids = []
begin
# instagram limits to 60
query = {access_token: user.instagram_token.token, count: 60}
query[:max_id] = next_max_id if next_max_id
results = HTTParty.get 'https://api.instagram.com/v1/users/self/media/recent', format: :json, query: query