This file contains hidden or 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
# Five lines of code that will make your underscore + CoffeeScript use cleaner. | |
# Creates an underscore function for each function in to_reverse with R (short for Reversed) appended to the name. | |
# The R version moves the function argument (first argument in normal underscore) to the end, | |
# so you can write: | |
$(window).scroll _.throttleR 500, -> | |
console.log "This print's at most every 500ms" | |
# Instead of: | |
$(window).scroll _.throttle -> | |
console.log "This prints at most every 500ms too" |
This file contains hidden or 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
cheater = | |
start_game: -> | |
@count = 0 | |
global.Math = {random: => @count++} | |
guess_index: (cur_num) -> | |
return cur_num | |
name: "Cheater" |
This file contains hidden or 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
import skein | |
from random import choice | |
target = '5b4da95f5fa08280fc9879df44f418c8f9f12ba424b7757de02bbdfbae0d4c4fdf9317c80cc5fe04c6429073466cf29706b8c25999ddd2f6540d4475cc977b87f4757be023f19b8f4035d7722886b78869826de916a79cf9c94cc79cd4347d24b567aa3e2390a573a373a48a5e676640c79cc70197e1c5e7f902fb53ca1858b6' | |
def bitcount(v): | |
if v > 0: | |
return (v & 1) + bitcount(v>>1) | |
else: | |
return 0 |
This file contains hidden or 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
### Keybase proof | |
I hereby claim: | |
* I am jimtla on github. | |
* I am jimtla (https://keybase.io/jimtla) on keybase. | |
* I have a public key whose fingerprint is 9997 4223 B138 49BF 6F43 C80F AA4A 7117 AC09 F449 | |
To claim this, I am signing this object: |
This file contains hidden or 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 ( | |
"log" | |
"net/http" | |
_ "net/http/pprof" | |
) | |
func wasteMemory() { | |
s := "ABCDEFGHIJKLMNOPQRSTUVWXYZ00123456789" |
This file contains hidden or 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 resizeAndWrite(img image.Image, width int, path string, c chan error) { | |
newImg := resize.Resize(uint(width), 0, img, resize.Bicubic) | |
err := writeJpegToS3(s, newImg, path) | |
// Write back to the channel with the status of the S3 write operation. | |
c <- err | |
} |
This file contains hidden or 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 createAlternateSizes(photoPath string, img image.Image, block bool) error { | |
// Put a white background on all the resized images. | |
whiteImg := imageWithWhiteBg(img) | |
c := make(chan error, 0) | |
go resizeAndWrite(whiteImg, 640, photoPath + "_f", c) | |
go resizeAndWrite(whiteImg, 290, photoPath + "_s", c) | |
go resizeAndWrite(whiteImg, 200, photoPath + "_d", c) | |
if block { |
This file contains hidden or 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 createAlternateSizes(photoPath string, img image.Image, block bool) error { | |
// Put a white background on all the resized images. | |
whiteImg := imageWithWhiteBg(img) | |
numberOfResizes := 3 | |
c := make(chan error, numberOfResizes) | |
go resizeAndWrite(whiteImg, 640, photoPath + "_f", c) | |
go resizeAndWrite(whiteImg, 290, photoPath + "_s", c) | |
go resizeAndWrite(whiteImg, 200, photoPath + "_d", c) | |
This file contains hidden or 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
21 @ 0x26be6 0x12f4d 0x135bc 0x69d24 0x26db0 | |
# 0x69d24 jello/models.resizeAndWrite+0x6145 | |
~/go/src/jello/models/photo.go:149 |
This file contains hidden or 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
#![feature(collections)] | |
#![feature(box_patterns)] | |
#[cfg(feature = "simple")] | |
pub fn matches(regex : &str, target : &str) -> bool { | |
match (regex.slice_shift_char(), target.slice_shift_char()) { | |
// Both strings are emtpy, so we've got a match. | |
(None, None) => true, | |
// We're looking at _*, match the kleene star. |
OlderNewer