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
const stream = require('stream'); | |
const fs = require('fs'); | |
const unzip = require('unzip-stream'); | |
const Zip2GeoJsonStream = require('./zip2geojson'); | |
const file = process.argv[2]; | |
const readStream = fs | |
.createReadStream(file) |
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
int str_cmp( char *str1, char *str2 ) { | |
if ( !*str1 && !*str2 ) | |
return 0; | |
char a = *str1, b = *str2; | |
if( a >= 'A' && a <= 'a' ) | |
a -= 32; | |
if( b >= 'A' && b <= 'a' ) | |
b -= 32; |
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
pushl 16(%ebp) // push the name onto the stack | |
call sizeof // get the size of the string | |
addl $4, %esp // move the stack pointer back | |
incl %eax // sizeof(name) + 1 | |
pushl %eax // push sizeof(name) + 1 | |
call allocate // malloc ( sizeof( name ) + 1 ) | |
addl $4, %esp // move the stack pointer back | |
cmpl $0, %eax // malloc failed, so return 0 | |
je allocfail |
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
> module Scan where | |
> import Char | |
> tokenize [] = [] | |
> tokenize (x:xs) | |
> | isSpace x = tokenize xs | |
> | isDigit x = fst (span isDigit (x:xs)) : tokenize (snd (span isDigit (x:xs))) | |
> | isAlpha x = fst (span isAlpha (x:xs)) : tokenize (snd (span isAlpha (x:xs))) | |
> | isSym x = fst (span isSym (x:xs)) : tokenize (snd (span isSym (x:xs))) | |
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
void squeeze ( char array[], int c ) { | |
int i, j; | |
for ( i = j = 0; array[i] != '\0'; ++i ) { | |
if ( array[i] != c ) | |
array[j++] = array[i]; | |
} | |
array[j] = '\0'; | |
} |
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
function make_adder( left_operand ) { | |
return function ( right_operand ) { | |
return left_operand + right_operand; | |
}; | |
} | |
so, you can say: | |
var plus_two = make_adder(2); | |
var plus_three = make_adder(3); | |
alert(plus_two(5)); |