This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var lastSeen = (new Date()).getTime(); | |
var engagedTime = 0; | |
var idleTimeout = 5000; | |
$(document).ready(function() { | |
$(window).on('focus click scroll mousemove touchstart touchend touchcancel touchleave touchmove', function() { | |
lastSeen = (new Date()).getTime(); | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script async src="https://www.themarshallproject.org/pixel.js"></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var elasticsearch = require('elasticsearch'); | |
var client = new elasticsearch.Client(); | |
var eventPattern = /([^ ]*) ([^ ]*) ([^ ]*) ([^ ]*) ([^ ]*) ([^ ]*) ([^ ]*) \"(.*?)\" \"(.*?)\" \"(.*?)\" \"(.*?)\" \"(.*?)\"/; | |
exports.handler = function(data, context) { | |
var events = []; | |
var encodedEvent, rawEvent, | |
matchedEvent, event, i, | |
commands; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'elasticsearch' | |
url = `heroku config --app <heroku-app-name> | grep "SEARCHBOX_SSL_URL:"`.split(": ").last.strip | |
client = Elasticsearch::Client.new(url: url) | |
# https://github.com/elasticsearch/elasticsearch-ruby/issues/49 | |
scan_response = client.search(index: 'pixels', search_type: 'scan', scroll: '5m', size: 10) | |
while response = client.scroll(scroll_id: scan_response['_scroll_id'], scroll: '5m') and !response['hits']['hits'].empty? do | |
puts response['hits']['hits'].map { |r| r['_source'] } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def pmap(items) | |
queue = Queue.new | |
threads = items.map do |item| | |
Thread.new do | |
queue.push yield(item) | |
end | |
end | |
threads.map &:join | |
output = [] | |
output << queue.pop until queue.empty? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://bitbucket.org/mailchimp/mailchimp-api-ruby/raw/fc745199610bc00ecb42388a241c8018e20cc4a1/lib/mailchimp/api.rb | |
module Mailchimp | |
class Folders | |
attr_accessor :master | |
def initialize(master) | |
@master = master |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Your bundle is complete! | |
Gems in the groups development and test were not installed. | |
It was installed into ./vendor/bundle | |
Bundle completed (1.42s) | |
Cleaning up the bundler cache. | |
! | |
! Command: 'set -o pipefail; curl --fail --retry 3 --retry-delay 1 --connect-timeout 3 --max-time 30 http://nodejs.org/dist/v0.10.30/node-v0.10.30-linux-x64.tar.gz -s -o - | tar zxf - node-v0.10.30-linux-x64/bin/node' failed unexpectedly: | |
! | |
! gzip: stdin: invalid compressed data--format violated | |
! tar: Unexpected EOF in archive |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sinatra' | |
require 'aws-sdk' | |
require 'digest/md5' | |
require 'dotenv' | |
Dotenv.load | |
$project_name = 'no-country' | |
$input_file = './index.html' | |
class S3Upload |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Document < ActiveRecord::Base | |
include HTTParty | |
format :json | |
base_uri "https://www.documentcloud.org" | |
debug_output $stdout # optional | |
def update_published_url | |
self.class.put("/api/documents/#{self.dc_id}.json", | |
basic_auth: { | |
username: ENV['DOCUMENTCLOUD_USERNAME'], |