Skip to content

Instantly share code, notes, and snippets.

@chrisvariety
chrisvariety / tos.html
Created February 8, 2017 14:04
GitHub ToS
<div class="article js-hide-during-search">
<h2>GitHub Terms of Service (DRAFT)</h2>
<div id="article-platform-nav">
<ul>
<li class="platform-mac">
<a href="#platform-mac" data-platform="mac">
mac
</a>

Keybase proof

I hereby claim:

  • I am speedmanly on github.
  • I am sync (https://keybase.io/sync) on keybase.
  • I have a public key whose fingerprint is 90CF 5660 3150 874B BAB1 507D D844 74D3 2939 950A

To claim this, I am signing this object:

// from underscore.js
var throttle = function(func, wait) {
var context, args, timeout, result;
var previous = 0;
var later = function() {
previous = new Date;
timeout = null;
result = func.apply(context, args);
};
return function() {
We have some public endpoints that are undocumented as you noticed. There are two of them, the first records Autocomplete Selections (in the dropdown) and the second records clicks on full-text search results (from the results page). The difference is very subtle since we try to keep the URLs short (/pas vs. /pc).
Autocomplete Selections:
/api/v1/public/analytics/pas
Full-text Clicks:
/api/v1/public/analytics/pc
There are a couple of ways to use these. The one that is leveraged by the JS libraries is a little more difficult since it requires use of the Swiftype internal document ID. The other way uses the document type's slug and the document's external_id. Here are example calls for that:
// Templating
// Adds the method "twirl" to every view to render its mustache template into itself
// Assumes views are keeping templates in: options.templates.tmpl_name
// twirl() -> renders options.template
// twirl(tmpl_name) -> renders options.templates.tmpl_name
_.extend(Backbone.View.prototype, {
twirl: function(tmpl_name) {
@chrisvariety
chrisvariety / production.rb
Created May 2, 2012 13:49
Rack Domain redirect
XXX.configure do
require 'rack_domain_redirect'
config.middleware.insert 0, Rack::DomainRedirect
end
@chrisvariety
chrisvariety / oinkplus.user.js
Created July 15, 2011 01:19
oinkplus 18 w/ myspace fixed
// ==UserScript==
// @name OiNKPlus
// @author Indieana AKA interonaut, indieana@mailpuppy.com
// @namespace http://www.myspace.com/interonaut
// @description Enables easy artist discovery by adding similar artists, tags, short bio and last.fm & Myspace player to torrent details pages.
// @include *waffles.fm/details.php*
// @include *88.80.6.249/details.php*
// @include *what.cd/torrents.php?id*
// @include *what.cd/artist.php?id*
// @include *libble.com/torrents.php?id*
@chrisvariety
chrisvariety / Gemfile
Created June 3, 2011 19:53
heroku redis test on cedar
gem 'redis_on_heroku'
@chrisvariety
chrisvariety / oinkplus.user.js
Created April 6, 2011 17:46
Fix for myspace april 6th, 2011
// ==UserScript==
// @name OiNKPlus
// @author Indieana AKA interonaut, indieana@mailpuppy.com
// @namespace http://www.myspace.com/interonaut
// @description Enables easy artist discovery by adding similar artists, tags, short bio and last.fm & Myspace player to torrent details pages.
// @include *waffles.fm/details.php*
// @include *88.80.6.249/details.php*
// @include *what.cd/torrents.php?id*
// @include *what.cd/artist.php?id*
// @include *stmusic.org/details.php*
module Delayed
class Worker
def handle_failed_job(job, error)
ExceptionNotifier.notify(error, :data => {:session => job.attributes})
job.last_error = error.message + "\n" + error.backtrace.join("\n")
say "* [JOB] #{name} failed with #{error.class.name}: #{error.message} - #{job.attempts} failed attempts", Logger::ERROR
reschedule(job)
end
end