Skip to content

Instantly share code, notes, and snippets.

View brianloveswords's full-sized avatar
💭
computering

Brian J Brennan brianloveswords

💭
computering
View GitHub Profile
addThree x y z = x + y + z
addThree :: (Num a) => a -> a -> a -> a
addThree x y z = x + y + z
var addThree = function(x, y, z) { return x + y + z; } //wrong
addThree x y z = x + y + z
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