Skip to content

Instantly share code, notes, and snippets.

View Incognito's full-sized avatar

Brian Graham Incognito

View GitHub Profile
@Incognito
Incognito / ycombinator.js
Created September 29, 2011 18:42
My Y-Combinator example
/*
First group takes a function and returns a
function that calls a function with an
argument
*/
(function (ycomb) {
return (function(n){
return ycomb(ycomb)(n);
});
/*
@Incognito
Incognito / robotButton.js
Created November 4, 2011 14:24 — forked from joshuasiler/robotButton.js
Javascript function that adds a little surprise to your HTML elements.
/* USAGE EXAMPLE
<style>
.example { padding:15px; border: 2px solid #888; width:100px;float:left;margin-left: 5px; font-size: 50px; margin-top: 50px; }
</style>
<div id="example1" class="example">1</div>
<div id="example2" class="example">2</div>
<div id="example3" class="example">3</div>
<div id="example4" class="example">4</div>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script type="text/javascript" src="/javascript/robotButton.js"></script>
@Incognito
Incognito / oneboxplugin.md
Created December 5, 2011 19:07
SE chat Onebox plugin module

#StackExchange chat Onebox plugin module

Consider the following

##JSON manifest of XPATH data

  1. Provide a URL
  2. Provide a token ID/XPATH pair
  3. Provide HTML template
@Incognito
Incognito / errorlog.sql
Created December 6, 2011 15:49
Psudo-error loggging JS thinger.
CREATE TABLE errorLog (
Timestamp,
IP,
Line,
ErrorMessage,
URL,
Cookies,
UserAgent,
Plugins,
$ | \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 / .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');
@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 / 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                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
>>
>> NOTICE: Not a buildrump.sh-based git repo in /home/brian/unik/rumprun/src-netbsd
>> Cannot verify repository version. Proceeding ...
>>
Tool CC : /usr/bin/cc
Tool AR : /usr/bin/ar
Tool NM : /usr/bin/nm
Tool OBJCOPY : /usr/bin/objcopy
Tool AS : /usr/bin/as
Tool CXX : /usr/bin/false