Skip to content

Instantly share code, notes, and snippets.

View broox's full-sized avatar
🤠
hey

Derek Brooks broox

🤠
hey
View GitHub Profile
@SleepWalker
SleepWalker / swipe.js
Created September 30, 2015 04:59
A simple swipe detection on vanilla js
var touchstartX = 0;
var touchstartY = 0;
var touchendX = 0;
var touchendY = 0;
var gesuredZone = document.getElementById('gesuredZone');
gesuredZone.addEventListener('touchstart', function(event) {
touchstartX = event.screenX;
touchstartY = event.screenY;
/**
* ps_Nest Thermostat
*
* Copyright 2014 Patrick Stuart
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@stevej
stevej / gist:3868225
Created October 10, 2012 20:29 — forked from anonymous/gist:3868185
Queue Anti-patterns (an argument in DMs)
I can make a case that queues only do what people want if you don’t consider failure cases.
Qs are empty (normal) or full (fail). Normally things are processed quickly. Failure case processing time is unbounded (or “too long”).
Solution is always “dump the Q”. Which means you do care about how long it takes to process items. So you want the queue to always be empty
Which means you only want a non-failing Q.
So why not admit it, use in-proc buffers, run enough servers to handle load? Reject work up front instead of dropping oldest items w/…
@strangerstudios
strangerstudios / my_pmpro_members_list_csv_extra_columns.php
Last active April 7, 2018 21:10
Add Website and Nickname Fields to the Paid Memberships Pro Members List CSV Export
/*
Plugin Name: PMPro Extra Members List CSV Export Columns
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-extra-members-list-csv-export-columns/
Description: Add extra fields to the Paid Memberships Pro Members List CSV Export
Version: .1
Author: Stranger Studios
Author URI: http://www.strangerstudios.com
Notes on use:
@harperreed
harperreed / s3_mirror_site.sh
Created July 10, 2012 02:57
Create an static S3 bucket to mirror a site
#!/bin/bash
#this will mirror a website, upload to s3, and make it publically available.
#install s3cmd. install wget. (i use homebrew).
#configure s3cmd (s3cmd --configure)
# run this by doing: mirror_site.sh www.example.org
wget --mirror -p --html-extension --convert-links -e robots=off -P . $1
s3cmd mb s3://$1
@broox
broox / Haversine.md
Created April 15, 2012 15:56
Haversine Distance Formulas

Haversine Formula

used to calculate the great circle distance between two points on the earth (specified in decimal degrees)

Earth's Radius

  • Miles: 3956
  • Kilometers: 6371

Javascript

<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>SoundCloud OAuth 2 User Agent Authentication Flow Demo</title>
<script type="text/javascript" charset="utf-8" src="javascript/jquery-1.4.2.js"></script>
<script type="text/javascript" charset="utf-8">
$(function () {
var extractToken = function(hash) {