Skip to content

Instantly share code, notes, and snippets.

View ascheink's full-sized avatar

Andrei Scheinkman ascheink

View GitHub Profile
@ascheink
ascheink / Preferences.sublime-settings
Last active August 29, 2015 14:05
Settings for Sublime Text
{
"color_scheme": "Packages/User/Mac Classic (SL).tmTheme",
"font_size": 15,
"ignored_packages":
[
"Vintage"
],
// workspace
"remember_open_files": false,
scroll = function() { window.scrollTo(0, document.body.scrollHeight); }
int = setInterval(scroll, 1000); // start
clearInterval(int); // stop
@ascheink
ascheink / gitmo-splash.rb
Last active December 13, 2015 20:08
Code to quickly create a mosaic image of the faces of the detainees still in Gitmo http://i.imgur.com/tIqdGtH.jpg
require 'nokogiri'
require 'httparty'
puts "Scraping ids of detainees in custody"
ids = []
(1..10).each do |n|
response = HTTParty.get "http://projects.nytimes.com/guantanamo/detainees/held?page=#{n}"
page = Nokogiri::HTML(response)
ids += page.css('#detaineesTable a').map { |link| $1 if /detainees\/(\d+)/ =~ link['href'] }.compact
end
@ascheink
ascheink / data-reporter.txt
Last active December 12, 2015 10:19
Job openings with the data journalism desk at The Huffington Post
Data Reporter
The Huffington Post is looking for a data reporter to join our data journalism desk.
You'll work on a small team in the Huffington Post newsroom in New York City, using math and
computer programming to help readers explore and understand the data behind the news. You'll
pitch, design and develop data-driven news stories, interactive databases, and static, interactive
and real-time graphics.
You're passionate about finding and telling stories through data. You have good news
@ascheink
ascheink / scrape_links.rb
Created November 14, 2012 22:55
HuffPost 100 most recent links for tag
@ascheink
ascheink / count.rb
Created November 12, 2012 22:47
Election map shares
require 'rubygems'
require 'httparty'
def trackbacks url
response = HTTParty.get "http://otter.topsy.com/trackbacks.json?url=#{url}"
response['response']['trackback_total']
end
def shares url
response = HTTParty.get "https://graph.facebook.com/?ids=#{url}"
@ascheink
ascheink / esi_development.rb
Created January 17, 2011 23:51
Try ESI's locally
module ApplicationHelper
USE_AJAX_FOR_ESIS = false
def my_render_esi(path)
response.headers['X-RUN-ESI'] = 'true'
if Rails.env.development?
if USE_AJAX_FOR_ESIS