Skip to content

Instantly share code, notes, and snippets.

View mattbasta's full-sized avatar
🌭
Still writing JavaScript

Matt Basta mattbasta

🌭
Still writing JavaScript
View GitHub Profile
import binascii
import hashlib
import json
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.ciphers import algorithms, Cipher, modes
from django.conf import settings
from pinecast.helpers import gravatar
import binascii
# import codecs
import hashlib
import json
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.ciphers import algorithms, Cipher, modes
from django.conf import settings
from pinecast.helpers import gravatar
// this is crazy
Function.prototype.callMeMaybe = function(ctx) {
if (Math.random() > .5) {
return this.apply(ctx, Array.prototype.slice.call(arguments, 1));
}
};
function square(n) {
return n * n;
}
"""BBEdit UNIX filter that wraps one or more optionally-indented, commented
lines to 79 chars, preserving indentation.
Just select all the lines (in their entirety) the comment spans, and invoke.
Works with #, --, and //-style comments.
For example, this... ::
# Upping this to 10000 makes it 3x faster. 10000 takes 15.936s. 5000 takes 16.303s.
#!/bin/bash
# Which version should we fetch?
b2gremote="https://ftp.mozilla.org/pub/mozilla.org/b2g/nightly/latest-mozilla-central/"
appname="B2G"
if [ "$1" == "aurora" ]; then
b2gremote="https://ftp.mozilla.org/pub/mozilla.org/b2g/nightly/latest-mozilla-aurora/"
appname="B2GAurora"
fi
$.fn.serializeObject = function() {
var data = {};
_.each($(this).serializeArray(), function(v, k) {
k = v.name;
v = v.value;
if (_.contains(k, '__prefix__')) {
return;
}
if (k.match(/\-\d+\-/g)) {
// Turn `users-0-name=Basta` into
@mattbasta
mattbasta / rainbow.js
Last active December 14, 2015 18:39 — forked from anonymous/rainbow.js
/*
Original graphicsbc source:
a0,0
p250,300
t20,0
L
10
Ha0 ,255,128
def log_gen(n):
import math
y = 1
while y < n:
adder = max(1, 10 ^^ int(math.log10(y)))
yield int(y)
y += adder