Since Twitter doesn't have an edit button, it's a suitable host for JavaScript modules.
Source tweet: https://twitter.com/rauchg/status/712799807073419264
const leftPad = await requireFromTwitter('712799807073419264');
#!/bin/bash | |
# Encrypt an existing partition with LUKS2 on Ubuntu 20.04 LTS | |
# DISCLAIMER: USE AT YOUR OWN RISK AND MAKE BACKUPS | |
# Made for my personal use and has almost NO error checking!! | |
# Based on instructions from: | |
# https://wiki.archlinux.org/index.php/dm-crypt/Device_encryption#Encrypt_an_existing_unencrypted_filesystem | |
DISK="$1" |
#!/usr/bin/env python | |
# Write a function that determines if any of its arguments evaluates to True. | |
def test_find_true(): | |
""" | |
>>> find_true(True, {}) | |
True | |
>>> find_true(None, (), 0) | |
False | |
""" |
Since Twitter doesn't have an edit button, it's a suitable host for JavaScript modules.
Source tweet: https://twitter.com/rauchg/status/712799807073419264
const leftPad = await requireFromTwitter('712799807073419264');
I'm going to cover a simple, but effective, utility for managing state and transitions (aka workflow). We often need to store the state (status) of a model and it should only be in one state at a time.
/* | |
* L.TileLayer is used for standard xyz-numbered tile layers. | |
*/ | |
L.Google = L.Class.extend({ | |
includes: L.Mixin.Events, | |
options: { | |
minZoom: 0, | |
maxZoom: 18, | |
tileSize: 256, |
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import os | |
import sys | |
import errno | |
from string import Template | |
from slugify import slugify | |
from xml.dom.minidom import parse |
##Chai Expect
##Language Chains
Been looking for a full stack including tools for gettext-style i18n with AngularJS.
Ended up (working proof of concept) with the following:
// 32 bit FNV-1a hash | |
// Ref.: http://isthe.com/chongo/tech/comp/fnv/ | |
function fnv32a( str ) | |
{ | |
var FNV1_32A_INIT = 0x811c9dc5; | |
var hval = FNV1_32A_INIT; | |
for ( var i = 0; i < str.length; ++i ) | |
{ | |
hval ^= str.charCodeAt(i); | |
hval += (hval << 1) + (hval << 4) + (hval << 7) + (hval << 8) + (hval << 24); |
<div class="switch switch-small" bootstrap-switch="sync"> | |
<input id="syncswitch" type="checkbox" /> | |
</div> | |
module.directive('bootstrapSwitch', function() { | |
return { | |
restrict:'A', | |
scope: { | |
sync: true | |
}, |