This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
addThree x y z = x + y + z |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
addThree :: (Num a) => a -> a -> a -> a | |
addThree x y z = x + y + z |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var addThree = function(x, y, z) { return x + y + z; } //wrong |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
addThree x y z = x + y + z |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |