(C-x means ctrl+x, M-x means alt+x)
The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf
:
from django.http import HttpResponse | |
from django.utils.functional import wraps | |
from django.template.context import RequestContext | |
from django.template.loader import get_template | |
from django.utils import simplejson as json | |
def dict_to_template_view(**template_args): | |
""" | |
Takes a function that returns a dict and decorates it into a template-rendering view | |
""" |
from django.db import models | |
from django.utils.decorators import wraps | |
from django.core.exceptions import ValidationError | |
def constraint(func): | |
@wraps(func) | |
def inner(*args, **kwargs): | |
func._is_constraint = True | |
return func(*args, **kwargs) | |
return inner |
# MAC manipulators | |
alias random_mac='sudo ifconfig en0 ether `openssl rand -hex 6 | sed "s/\(..\)/\1:/g; s/.$//"`' | |
alias restore_mac='sudo ifconfig en0 ether YOUR_ORIGINAL_MAC_ADDRESS_GOES_HERE' |
# Observations about binary and binary operations: | |
* Bitshifting by 1 either adds or subtracts a multiple of 2 from each factor of 2. | |
** Take, for example, the number 10 (decimal) | |
** 10 = 8 + 2 = 1*(2^3) + 0*(2^2) + 1*(2^1) + 0*(2^0), or 1010 in binary. | |
** If you shift each of these bits to the left by 1, you get 10100. | |
** This took each of the 1 bits (multiples of 2) in the binary representation and multplied each by 2: | |
*** 10100 is 1*(2^4) + 0*(2^3) + 1*(2^2) + 0*(2^1) + 0*(2^0) = 16 + 0 + 4 + 0 + 0 = 20. | |
*** Notice that 20 = 16 + 4 = 2*8 + 2*2 = 2*(8 + 2). |
tl;dr: The problems inherent in jQuery dependency should not be resolved by not depending on jQuery or some other $
-providing library. Rather, library authors should write library code that expects a $
will be injected that meets the library's needs.
In the front-end JS world, there is a movement to be dependency-free, and specifically to be jQuery dependency free. This problem seems to be the result of a pre-package management mindset. But those days are long gone, or, they should be.
The result of this mindset, however, tends to not be pretty: library authors write their own, often minimally tested, DOM manipulation and utility belt routines. If you come to depend on multiple or many such libraries, your code, via their code, then comes to contain dozens of diverse implementations of similarly or identically-purposed functions.
users
table:
[
{
id: 123,
things: [1, 2, 3]
}
]
var bignum = require('bignum'); | |
var crypto = require('crypto'); | |
var randomBignum = function() { return bignum.fromBuffer(crypto.pseudoRandomBytes(8)); } | |
var avg = randomBignum(); | |
var avg_len = avg.bitLength(); | |
var lengths = {}; | |
for (var i = 0; i < 1e6; i++) { |
// Index: | |
r.table("heroes").indexCreate("idEquipment", function(doc) { | |
return doc("equipment").map(function(equipment) { | |
return [doc("id"), equipment] | |
}) | |
}, {multi: true}).run(conn, callback) | |
// Query | |
r.table("heroes").getAll([1, "boots"], {index: "idEquipment"}).run(conn, callback) |
r.db('test').table('crap').get("dd3badb0-9c30-4ef5-978a-c034461d58ca").update({ | |
unit_data: r.literal(r.row('unit_data').without('state')) | |
}) |