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 / 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);
class @Reloader
constructor: (@selector = '.wrapper', @path, @interval = 2000) ->
@start()
start: =>
@timer = setInterval(@fetch, @interval)
stop: =>
clearInterval(@timer)
@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
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 / 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

@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
# Alex MacCaw
# info@eribium.org
# Paranoid Hash
# This is so you don't need to validate options on initialize - as you may not require all the options for every method.
# You can validate them as the program runs - so you don't get unexpected nils.
# I still haven't decided whether this is a good idea or not ;)
# class Foo
# attr_reader :options
# Installing a Rails Stack on EC2/Ubuntu
# based on ami-1c5db975 - see http://alestic.com/ for more info.
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install build-essential
sudo apt-get install ruby rdoc mysql-server libmysql-ruby ruby1.8-dev irb1.8 libdbd-mysql-perl libdbi-perl libmysql-ruby1.8 libmysqlclient15off libnet-daemon-perl libplrpc-perl libreadline-ruby1.8 libruby1.8 mysql-client-5.0 mysql-common mysql-server-5.0 ruby1.8 subversion rubygems libopenssl-ruby irb rake
# Advanced to_xml
#
# Alex MacCaw
# info@eribium.org
#
# Provide to_xml support to things like strings,
# so you can now actually do ['foo'].to_xml without
# it throwing an exception.
#
# One gotcha to look out for is Rails calls
# The first few steps I always make when creating a new Rails app
# Alex MacCaw
# info@eribium.org
# cd home
cd
# Setup your svn repo
svn mkdir your_svn_details/app_name
svn mkdir your_svn_details/app_name/trunk