Skip to content

Instantly share code, notes, and snippets.

@DavidLGoldberg
DavidLGoldberg / gist:e0e2fbf9152cb4067d2f
Created December 23, 2014 21:22
Quick and dirty asterisk make file I was playing with to connect with websocketd
.PHONY: all clean start asterisk websocketd
all: clean start
clean:
echo > call_log
-sudo killall asterisk
-sudo killall websocketd
start: asterisk websocketd
@DavidLGoldberg
DavidLGoldberg / gist:3bc09209de5abbdbd2a0
Created December 23, 2014 21:19
Some dirty CSV parsing I'll probably never need
#!/usr/bin/env ruby
# This script translates Christy's Company's investors to all companies by investors.
# INPUT: arg0 as a path to a csv
# OUTPUT: arg1 as a path to a csv
require 'CSV'
investors = {}
CSV.foreach(ARGV[0], {headers: false}) do |row|
@DavidLGoldberg
DavidLGoldberg / gist:c386f9d770f2871ca9c7
Created December 23, 2014 20:54
Some Prompt stuff I used a few times...just keeping for reference.
#!/bin/bash
#Taken from:
#https://gist.github.com/1965569
function ask {
while true; do
if [ "${2:-}" = "Y" ]; then
prompt="Y/n"
@DavidLGoldberg
DavidLGoldberg / gist:059e2bb5a39166be8e01
Created December 2, 2014 19:25
Log document.registerElement() for use with Polymer / Custom Elements
<script>
originalRegister = document.registerElement;
document.registerElement = function() {
console.log('document.registerElement called with:', arguments);
// Call the function as it would have been called normally:
originalRegister.apply(this, arguments);
}
</script>
@DavidLGoldberg
DavidLGoldberg / styles.less
Last active August 29, 2015 14:04
Make Jumpy labels orange
atom-text-editor::shadow .jumpy {
&.label {
background-color: orange;
color: black;
}
&.jump {
}
}
@DavidLGoldberg
DavidLGoldberg / gist:166646fce043710ef920
Last active February 28, 2019 17:12
Green cursor (slight pulse) for Atom editor with vim-mode
.editor.vim-mode.command-mode::shadow {
.cursor.idle, .cursor.idle.blink-off {
background-color: #00ff44; // bright green
visibility: visible;
opacity: .5;
border-style: solid;
border-width: 1px;
border-color: #ff0000; // bright red
}
.cursor.idle.blink-off {
@DavidLGoldberg
DavidLGoldberg / gist:3182378
Created July 26, 2012 14:28
Grabs first few characters from commit sha
git log -n 1 --no-merges --pretty=format:"%h"
#can be used for cache busting in combination with post comit...
@DavidLGoldberg
DavidLGoldberg / _m_port.py
Created July 17, 2012 05:46
Not sure this is useful. Turns directories that start with _m_ and contain mustache templates into a module. Meant to be used at build time.
import pystache
import os, glob
#TODO: use argparse or some config vars
ACTIONS_DIR_PREFIX = '_m_'
MAIN_TEMPLATE_NAME = 'main.mustache'
START_WALK = os.getcwd()
ENV = {}
for root, directories, files in os.walk(START_WALK):
@DavidLGoldberg
DavidLGoldberg / gist:2268542
Created March 31, 2012 21:10
Test local config for flask (using in heroku)
import os
from flask import Flask
PROJECT_ROOT = os.path.dirname(os.path.realpath(__file__))
app = Flask(__name__,
static_folder=os.path.join(PROJECT_ROOT, 'public'),
static_url_path='/public')
try:
@DavidLGoldberg
DavidLGoldberg / gist:2259618
Created March 31, 2012 05:21
Serve up static content in heroku's public folder
import os
from flask import Flask
from werkzeug import SharedDataMiddleware
PROJECT_ROOT = os.path.dirname(os.path.realpath(__file__))
app = Flask(__name__,
static_folder=os.path.join(PROJECT_ROOT, 'public'),
static_url_path='/public')