Skip to content

Instantly share code, notes, and snippets.

View tylerdavis's full-sized avatar

Tyler Davis tylerdavis

View GitHub Profile
@tylerdavis
tylerdavis / bitbucket_pr_file_collapse.js
Last active March 1, 2018 23:32
Bitbucket PR File Collapse - Add a button to each file in bitbucket PRs to collapse and expand the file
// ==UserScript==
// @name Bitbucket PR File Collapse
// @version 0.1
// @description Add a button to each file in bitbucket PRs to collapse and expand the file
// @author Tyler Davis <tyler@tmd.io>
// @match https://bitbucket.org/atlassian/*/pull-requests/*
// @grant none
// ==/UserScript==
(window.addEventListener('load', function () {
### Keybase proof
I hereby claim:
* I am tylerdavis on github.
* I am tmd (https://keybase.io/tmd) on keybase.
* I have a public key whose fingerprint is 0FEA E91F B193 6BD5 9F76 F71F 9FB2 3D96 0B3E DE20
To claim this, I am signing this object:
@tylerdavis
tylerdavis / agar.io
Last active April 30, 2017 15:32
Allows you to join a specific instance of Agar.io. Install the Tampermonkey Chrome Extension, create a new script and insert this. https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo
function loadScript(src, callback)
{
var s,
r,
t;
r = false;
s = document.createElement('script');
s.type = 'text/javascript';
s.src = src;
s.onload = s.onreadystatechange = function() {
@tylerdavis
tylerdavis / color.js
Last active August 29, 2015 14:18
wrangling color with javascript
/**
* Take a hex string, an rgb/a string, color name or an object.
* validate it and normalize to an rgba object
* @param {string|object} colorStringOrObject
* @returns {Color}
*/
function Color(colorStringOrObject) {
if (colorStringOrObject instanceof Color) {
return colorStringOrObject;
}
@tylerdavis
tylerdavis / service_base.rb
Created December 31, 2014 21:50
Service objects
class ServiceBase
attr_reader :model, :errors
class AbstractMethodError < Exception
end
def initialize(model)
@model = model
@errors = []
@tylerdavis
tylerdavis / logo.html
Created September 29, 2014 02:02
SoundViz Logo
<!DOCTYPE html>
<meta charset="utf-8">
<head>
<script src="http://cdnjs.cloudflare.com/ajax/libs/d3/3.4.11/d3.js"></script>
</head>
<body>
<script>
var color = 'forestgreen';
var dimensions = { x : 800, y : 800 };
var lineData = [0, -60, 150, -400, 750, -650, 350, -145, 40, 0];
@tylerdavis
tylerdavis / EventMap.js
Last active August 29, 2015 14:03
A Declarative Event Delegation Pattern - similar to backbone, define your event mapping with a simple syntax. The difference is that, instead of relying on binding and unbinding event handlers for each element that may come in to play, we're using event delegation and bubbling - a much cleaner approach.
/**
* A convenience class for abstracting event mapping.
* This can be injected in to any standard javascript class that couples with UI,
* similar to how backbone event mapping works, but, well.. better.
* @param el The scope of the selectors used in the event map.
* @param options
* @param options.events {{String} : { events : {Array}, handler : {String | Array}}}
*
* {
* 'selector' : {
{
"bitwise" : true,
"eqeqeq" : true,
"forin" : true,
"freeze" : true,
"newcap" : true,
"noarg" : true,
"noempty" : true,
"nonew" : true,
"undef" : true,
[unix_http_server]
file=/tmp/supervisor.sock ; path to your socket file
[supervisord]
logfile=/var/log/supervisord/supervisord.log ; supervisord log file
logfile_maxbytes=50MB ; maximum size of logfile before rotation
logfile_backups=10 ; number of backed up logfiles
loglevel=error ; info, debug, warn, trace
pidfile=/var/run/supervisord.pid ; pidfile location
nodaemon=false ; run supervisord as a daemon
worker_processes 2;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
use epoll;
}