portmaster irc/irssi
portmaster irc/irssi-xmpp
brew install irssi
# Vagrant commands | |
vagrant reload #! | |
vagrant status | |
vagrant suspend | |
vagrant resume | |
vagrant halt | |
vagrant up | |
vagrant package | |
vagrant destroy | |
vagrant box add <nombre> <url> |
FROM tianon/centos:5.8 | |
RUN yum install -y curl tar gcc make xz | |
RUN mkdir /usr/src/python | |
WORKDIR /usr/src/python | |
RUN curl -Sl "https://www.python.org/ftp/python/2.7.8/Python-2.7.8.tar.xz" > Python-2.7.8.tar.xz | |
RUN xz -dc < Python-2.7.8.tar.xz > Python-2.7.8.tar | |
RUN tar -xvf Python-2.7.8.tar -C /usr/src/python --strip-components=1 | |
# You may want to verify the download with gpg: https://www.python.org/download |
FROM tianon/centos:5.8 | |
RUN yum install -y curl tar gcc make xz | |
RUN mkdir /usr/src/python | |
WORKDIR /usr/src/python | |
RUN curl -Sl "https://www.python.org/ftp/python/2.7.8/Python-2.7.8.tar.xz" > Python-2.7.8.tar.xz | |
RUN xz -dc < Python-2.7.8.tar.xz > Python-2.7.8.tar | |
RUN tar -xvf Python-2.7.8.tar -C /usr/src/python --strip-components=1 | |
# You may want to verify the download with gpg: https://www.python.org/download |
--- | |
# Do this? | |
- name: create droplet 512MB/Centos 7/Region NYC2 | |
digital_ocean: > | |
command=droplet | |
state=present | |
name={{ droplet_name }} | |
client_id={{ client_id }} | |
api_key={{ api_key }} | |
size_id=66 |
""" | |
A little demo of some of the quirks of Python "closures" with inner functions. | |
Function closures allow a function to access nonlocal variables in the | |
enclosing scope, even when invoked outside it's immediate lexical scope. | |
In languages centered around mutable data types, you would expect to be | |
able to mutate nonlocals in a closure. | |
MDN has an excellent rundown of closures, with examples in Javascript. | |
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Closures |
""" | |
A demonstration of safe and unsafe ways to write and call Python functions that | |
take required and optional arguments that are likely to change over time. | |
Try performing common refactoring operations on the functions such | |
as adding/removing required/optional args and changing args to and from | |
required to optional. Also consider combinations of these operations. | |
The calling patterns marked dangerous are likely to break in some of these | |
situations, whereas the safe pattern of always calling with keywords |
from flask import Flask | |
app = Flask(__name__) | |
import datetime | |
from threading import local | |
threadlocal = local() | |
@app.route('/') |
from threading import local | |
threadlocal = local() | |
# foo takes a as an arg, but we can also see it is dependent on x from | |
# threadlocal if we look in the body. | |
def foo(a): | |
return a + threadlocal.x | |
# bar takes a as an arg, and calls foo on it. Unless we read through the |
var VisEventsView = Backbone.View.extend({ | |
// A Backbone.View extension that allows a View to trigger events when | |
// it's visibility changes. The view may also listen to its own visibility | |
// events. | |
setup_visibility_observer: function() { | |
// Check if view element is visible when attributes of el change. | |
var t = this; | |
_.bindAll(t, 'check_visibility'); | |
t.visibility_observer = new MutationObserver(t.check_visibility); |