Skip to content

Instantly share code, notes, and snippets.

View brianloveswords's full-sized avatar
💭
computering

Brian J Brennan brianloveswords

💭
computering
View GitHub Profile
db.open(function(err, client){
var is_setup = null;
var hash_col = null;
var user_col = null;
var continue_execution = function(){
if ( !(is_setup && hash_col && user_col) ) return false;
sys.puts('setup and found collections');
start_stream();
return true;
var buildSelect = function(name, options) {
var select = $('<select>');
var option;
select
.attr('name', name)
.attr('id', name);
for (var j in options) {
if (!options.hasOwnProperty(j)) continue;
option = $('<option>');
option.attr('value', j).html(options[j]);
@brianloveswords
brianloveswords / bootstrap.sh
Created June 2, 2011 18:40 — forked from anonymous/bootstrap.sh
Django on Heroku with Celery and Sentry
virtualenv --no-site-packages .
source bin/activate
bin/pip install Django psycopg2 django-sentry
bin/pip freeze > requirements.txt
bin/django-admin.py startproject mysite
cat >.gitignore <<EOF
bin/
include/
lib/
EOF
@brianloveswords
brianloveswords / .emacs
Created June 7, 2011 21:22 — forked from paulosman/.emacs
Shell script that runs pyflakes and pep8
(when (load "flymake" t)
(defun flymake-pyflakes-init ()
(let* ((temp-file (flymake-init-create-temp-buffer-copy
'flymake-create-temp-inplace))
(local-file (file-relative-name
temp-file
(file-name-directory buffer-file-name))))
(list "pychecker.sh" (list local-file))))
(add-to-list 'flymake-allowed-file-name-masks
'("\\.py\\'" flymake-pyflakes-init)))
@brianloveswords
brianloveswords / gist:1163558
Created August 22, 2011 21:02 — forked from voodootikigod/gist:1155790
PyCodeConf Ticket Give-away
Day job:
Web Tinkerer with Mozilla Foundation & P2PU
Favorite Python project:
Academic favorite: PyPy. I'm a sucker for language experimentation and meta-circular evaluators.
Practical favorite: flask. It's simple, it's clean (using decorators for routes is fantastic), it's self-contained. Great for prototyping and simple apps.
Favorite Conference:
It may sound like I'm sucking up, but honestly it was CodeConf. If only for Jeremy Ashkenas's talk on literate programming (but also for everything else).
@brianloveswords
brianloveswords / gist:1166166
Created August 23, 2011 19:08
Capturing for a User Event
// HTML
// <div id='container'>
// <button id='element'>Do whatever</button>
// </div>
var element = document.getElementById('element');
var container = document.getElementById('container');
element.addEventListener('click', function(e){
var action = function(){
// start a loop, polling for the return on your post message
@brianloveswords
brianloveswords / gist:1170258
Created August 25, 2011 08:49
Is this a bug?
$ boom
docs (5)
$ boom docs
express: http://expressjs.com/guide.html
node: http://nodejs.org/docs/v0.4.11/api/
org-mode: http://orgmode.org/manual/index.html
request: https://github.com/mikeal/request
vows: http://vowsjs.org/
@brianloveswords
brianloveswords / get-http-codes.sh
Created August 26, 2011 07:36
bash: get http response codes for a list of URLs
#!/bin/bash
# from http://www.hilarymason.com/blog/bash-get-http-response-codes-for-a-list-of-urls/
while read line
do
echo $(curl --write-out %{http_code} --silent --output /dev/null $line)
done <$1
@brianloveswords
brianloveswords / gist:1214267
Created September 13, 2011 16:37
Provisioning for openbadges
Exec {
path => [
'/usr/local/bin',
'/usr/local/sbin',
'/usr/bin/',
'/usr/sbin',
'/bin',
'/sbin'],
logoutput => true,
}
(defvar backup-dir
(concat "/Users/" (user-login-name) "/.emacs.d/emacs-backups/"))
(setq backup-directory-alist
(list
(cons "." backup-dir)))
(setq backup-by-copying t ;; don't clobber symlinks
backup-directory-alist
'(("." . "~/.emacs.d/autosaves/")) ;; don't litter