Skip to content

Instantly share code, notes, and snippets.

View stevewillard's full-sized avatar

Steve Willard stevewillard

View GitHub Profile
@stevewillard
stevewillard / index.js
Created December 28, 2017 15:16
shapefile to geojson
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)
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;
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
> 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)))
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';
}
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));