Skip to content

Instantly share code, notes, and snippets.

View maccman's full-sized avatar
🦜
gpu poor

Alex MacCaw maccman

🦜
gpu poor
View GitHub Profile
@maccman
maccman / batch_request.csv
Last active August 4, 2021 22:20
Clearbit Batch Example
@maccman
maccman / user_signup.rb
Created February 25, 2016 18:48
Clearbit & Customer.io integration
class UserSignup
# We're using a job queuing service called Sidekiq
# so that signups are processed and pushed to
# customer.io asyncronously.
include Sidekiq::Worker
attr_reader :user, :lookup
def perform(user_id)
# Find the user by ID
@maccman
maccman / technologies.md
Last active August 29, 2015 14:24
Clearbit Tech Detect

Clearbit Tech Detect

Clearbit indexes the following technologies:

Name Type
Google Widgets google_widgets
Twitter Badge twitter_badge
Google Analytics google_analytics
Omniture Adobe Analytics omniture_adobe_analytics
@maccman
maccman / changelog.md
Last active August 29, 2015 14:21
Clearbit API Changelog

Clearbit API versions

Your API version controls the API and webhook behavior you see (e.g. what properties you see in responses, what parameters you’re permitted to send in requests, etc.). Your version gets set the first time you make an API request. When we change any of our APIs in a backwards-incompatible way, we release a new dated version, but to avoid breaking your code, we don’t change your version until you're ready to upgrade.

How can I upgrade versions?

Each of Clearbit's APIs is versioned separately. You can set the API version on a per-request basis, or globally in your dashboard. It's a good idea to keep the API version you're using up to date - we're often pushing shiny new data attributes.

API changelog

module PersonHub
module Extensions
module Version extend self
CURRENT_API_VERSION = '2015-04-30'
def registered(app)
app.set(:version) do |value|
condition { request_api_version >= value }
end
Vagrant::configure('2') do |config|
config.vm.define :box1, autostart: false do |box|
box.vm.box = 'raring'
box.vm.box_url = 'https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box'
box.vm.hostname = 'example.com'
box.vm.provider :aws do |aws, override|
aws.access_key_id = ENV['AWS_ACCESS_KEY_ID']
aws.secret_access_key = ENV['AWS_SECRET_ACCESS_KEY']
aws.keypair_name = 'aws'
@maccman
maccman / batch.rb
Created September 22, 2014 01:34
Batch Paginate in SQL
module Sequel
module Plugins
module Batch
module DatasetMethods
def batch_page(page_size = 2_000)
last_record = order(:iid.asc).first
last_iid = last_record && last_record.iid || 0
last_iid -= 1
loop do
class @Reloader
constructor: (@selector = '.wrapper', @path, @interval = 2000) ->
@start()
start: =>
@timer = setInterval(@fetch, @interval)
stop: =>
clearInterval(@timer)
@maccman
maccman / index.html
Created May 16, 2014 19:06
Rendering with an Event Loop
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<script type="text/javascript" src="../lib/parrot.js"></script>
<script type="text/javascript" src="../lib/parrot.example.js"></script>
<script type="text/javascript">
var widget = new ParrotWidget
document.body.appendChild(widget.el);
SELECT repository_language, count(repository_language) AS repos_by_lang
FROM [githubarchive:github.timeline]
WHERE repository_fork == "false"
AND type == "CreateEvent"
AND PARSE_UTC_USEC(repository_created_at) >= PARSE_UTC_USEC('2013-01-01 00:00:00')
AND PARSE_UTC_USEC(repository_created_at) < PARSE_UTC_USEC('2013-12-30 00:00:00')
GROUP BY repository_language
ORDER BY repos_by_lang DESC
LIMIT 100;