- Create a file to store our credentials:
sudo vim /etc/postfix/sasl_passwd
sudo vim /etc/postfix/sasl_passwd
# Based on https://github.com/sass/libsass/wiki/Building-with-autotools | |
# Install dependencies | |
apt-get install automake libtool | |
# Fetch sources | |
git clone https://github.com/sass/libsass.git | |
git clone https://github.com/sass/sassc.git libsass/sassc | |
# Create configure script |
{ | |
"vars": { | |
"@gray-base": "#000", | |
"@gray-darker": "lighten(@gray-base, 13.5%)", | |
"@gray-dark": "lighten(@gray-base, 20%)", | |
"@gray": "lighten(@gray-base, 33.5%)", | |
"@gray-light": "lighten(@gray-base, 46.7%)", | |
"@gray-lighter": "lighten(@gray-base, 93.5%)", | |
"@brand-primary": "darken(#428bca, 6.5%)", | |
"@brand-success": "#5cb85c", |
pmf.LockingHeader = Backbone.View.extend({ | |
initialize: function() { | |
_.bindAll(this, 'on_page_scroll'); | |
$(window).scroll(this.on_page_scroll); | |
}, | |
on_page_scroll: function() { | |
var t = document.getElementById('nav-boundary').getBoundingClientRect().top; | |
var nav = this.$el.find('#horizontal-nav'); | |
if(t < 0) { |
This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.
Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:
getTweetsFor("domenic", function (err, results) {
// the rest of your code goes here.
from threading import Timer | |
def debounce(wait): | |
""" Decorator that will postpone a functions | |
execution until after wait seconds | |
have elapsed since the last time it was invoked. """ | |
def decorator(fn): | |
def debounced(*args, **kwargs): | |
def call_it(): |
brew install python
$ python --version
-- this SQL can be used to calculate the rank of a given user in a game, | |
-- and the names/scores of those just above and below him. | |
-- This is useful in online games or citizen science projects where you | |
-- just want to see the 'proximity' of other users around you, not the entire global rank | |
-- I want to find the rank and score for user_3, and other users 3 above and 3 below. | |
WITH global_rank AS ( | |
SELECT name, score, rank() OVER (ORDER BY score DESC) FROM scores | |
) | |
SELECT * FROM global_rank |