This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Array.prototype.forEach.call(document.querySelectorAll('textarea'), function(el) { el.setAttribute('style', 'resize: vertical');}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var queryparams = (window.location.href.split("?")[1] || "") | |
.split("&") | |
.map(function(param) { | |
return param.split("=") | |
.map(function(part) { return decodeURIComponent(part); }); | |
}) | |
.reduceRight(function(prev, curr) { | |
if (curr.length == 2) { prev[curr[0]] = curr[1]; } | |
return prev; | |
},{}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" JavaScript formatting. | |
" Install https://github.com/rdio/jsfmt - npm install -g jsfmt | |
function! Jsformat() | |
let regel=line(".") | |
%!jsfmt --format=true | |
call cursor(regel, 1) | |
endfunction | |
autocmd BufRead,BufNewFile *.js setfiletype javascript | |
autocmd Filetype javascript command! Fmt call Jsformat() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var input = document.getElementById('myfileinput'); | |
var files = input.files; | |
var file = files[i]; | |
var xhr = new XMLHttpRequest(); | |
xhr.open('post', '/path/to/destination', true); | |
xhr.onreadystatechange = function() { | |
if (this.readyState != 4) { return; } | |
// request finished - handle response | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<!-- Based off of the infinity symbol from http://css-tricks.com/examples/ShapesOfCSS/ --> | |
<html> | |
<head><title>CSS Eyeball</title> | |
<style> | |
#eyeball { | |
position: relative; | |
width: 140px; | |
height: 100px; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[kurrik@ ~/workspace/golibs/twurlrc] (master) 105$ goinstall github.com/kurrik/golibs/oauth1a | |
[kurrik@ ~/workspace/golibs/twurlrc] (master) 106$ goinstall github.com/kurrik/golibs/twurlrc | |
goinstall: github.com/kurrik/golibs/twurlrc: open /Users/kurrik/src/go/src/pkg/github.com/kurrik/golibs/twurlrc: no such file or directory ($GOPATH not set) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func (c *Connection) Read(output chan string) error { | |
var err error | |
if err = c.connect(); err != nil { | |
return err | |
} | |
defer c.conn.Close() | |
if err = c.readHeaders(); err != nil { | |
return err | |
} | |
err = c.readChunkedData(output) // Blocks until stream ends |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# From http://en.wikipedia.org/wiki/Netcat | |
# Proxy HTTPS requests through http://localhost:8080 | |
# That way, Wireshark can sniff the traffic. | |
# Example usage: | |
# ./proxy.sh www.twitter.com | |
mkfifo tmp | |
mkfifo tmp2 | |
nc -k -l 8080 > tmp < tmp2 & |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func main() { | |
foo := 4 | 2 | 16 | |
foo &= (511 ^ 4) | |
fmt.Printf("%b", foo) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// I couldn't have come up with this sober / well rested | |
const ( | |
FACING_LEFT = 1 << iota | |
FACING_RIGHT = 1 << iota | |
PLAYER_STOPPED = 1 << iota | |
PLAYER_WALKING = 1 << iota | |
PLAYER_JUMPING = 1 << iota | |
) | |
a := map[int]*Animation{ |
OlderNewer