Skip to content

Instantly share code, notes, and snippets.

View Incognito's full-sized avatar

Brian Graham Incognito

View GitHub Profile
@Incognito
Incognito / .gitignore
Last active August 3, 2020 07:33
random-without-winning-streaks
node_modules
@Incognito
Incognito / plot.awk
Created August 1, 2020 06:21 — forked from katef/plot.awk
#!/usr/bin/awk -f
# This program is a copy of guff, a plot device. https://github.com/silentbicycle/guff
# My copy here is written in awk instead of C, has no compelling benefit.
# Public domain. @thingskatedid
# Run as awk -v x=xyz ... or env variables for stuff?
# Assumptions: the data is evenly spaced along the x-axis
# TODO: moving average
$ | \bigcup\limits_{i=1}^n A_i | = $
$ + ( \sum\limits_{i=0}^n | A_i | ) $
$ - ( \sum\limits_{i,j:1 \le i<j \le n} | A_i \cap A_j | ) $
$ + ( \sum\limits_{i,j,k:1 \le i < j < k \le n} | A_i \cap A_j \cap A_k | ) $
$ - ( \sum\limits_{i,j,k,l:1 \le i < j < k < l \le n} | A_i \cap A_j \cap A_k \cap A_l | ) $
@Incognito
Incognito / 10Code
Created March 5, 2013 13:57
The 10 code commandments
## The 10 code commandments
To the melody of "10 crack commandments"
https://www.youtube.com/watch?v=kyWTJWrH1aI
Or, the r-r-r-remix
https://soundcloud.com/lyle-lanley/lyle-lanley-project-the-ecstasy-of-crack-biggie-smalls-ennio-morricone
I've been in this game for years, it made me an animal
@Incognito
Incognito / astley
Created November 11, 2013 18:58
Junk. You don't want to cat this to your shell.
This file has been truncated, but you can view the full file.
[?25l                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
make: x86_64-rumprun-netbsd-gcc: Command not found
make -C ../sqlite
make[1]: Entering directory '/home/brian/rumprun-packages/sqlite'
make[1]: x86_64-rumprun-netbsd-gcc: Command not found
make -C build
make[2]: Entering directory '/home/brian/rumprun-packages/sqlite/build'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/home/brian/rumprun-packages/sqlite/build'
make install -C build
make[2]: Entering directory '/home/brian/rumprun-packages/sqlite/build'
make -C ../sqlite
make[1]: Entering directory '/home/brian/rumprun-packages/sqlite'
make -C build
make[2]: Entering directory '/home/brian/rumprun-packages/sqlite/build'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/home/brian/rumprun-packages/sqlite/build'
make install -C build
make[2]: Entering directory '/home/brian/rumprun-packages/sqlite/build'
make[3]: Entering directory '/home/brian/rumprun-packages/sqlite/build'
/usr/bin/mkdir -p '/home/brian/rumprun-packages/pkgs/lib'
make: Nothing to be done for 'all'.
@Incognito
Incognito / gist:3707161
Created September 12, 2012 14:53
Forwarding arguments of variadic function calls.
function q(){
console.log(arguments.length + " from q");
var b = function(){
console.log(arguments.length + " from b");
}
b.apply(this, arguments);
}
q(); //0 from q, 0 from b
q(1); //1 from q, 1 from b
@Incognito
Incognito / .md
Created March 8, 2012 19:46
jQuery/DOM/best-practices discussion with Ryan McGreal

#Why it's bad.

So, the problem with this...

function formatCurrency (data) {
    // format germany price
    var els = document.querySelectorAll('.price');
    for (var i=0; i<els.length; i++) {
        var price = parseInt(els[i].innerHTML.replace(/[^0-9]*/,''));
        var curr = els[i].getAttribute('data-currency');