Skip to content

Instantly share code, notes, and snippets.

View LetterCountI.js
function LetterCountI(str) {
str = str.split(" ");
var answer = "";
var mostRep = 1;
for (i = 0; i < str.length; i++)
if (eachWord(str[i]) > mostRep) {
mostRep = eachWord(str[i]);
answer = str[i];
}
if (mostRep === 1)
View gist:5370174
/* Unsorted */
/* this fixes self vs. internal link */
ul.tabmenu.formtab {
margin: 43px 0 0 0;
}
.commentarea .md a {
text-decoration: underline;
}
@frewsxcv
frewsxcv / README.md
Created Dec 6, 2012 — forked from mbostock/.block
Stacked Area Chart
View README.md

This stacked area chart is constructed from a TSV file storing the market share of several popular web browsers over the last year. Data is from Clicky Web Analytics. The chart employs conventional margins and a number of D3 features:

@frewsxcv
frewsxcv / gist:3825258
Created Oct 3, 2012 — forked from MLLeKander/gist:3825222
305 BoardTest Shell
View gist:3825258
#!/usr/bin/python
from sys import argv, stdin, stdout
import re
translate = {
'em': 'enterMove',
'sm': 'showMove',
'show': 'showBoard',
'am': 'applyMove',
'dm': 'doMove',
@frewsxcv
frewsxcv / short-functions.js
Created Mar 31, 2012 — forked from dherman/short-functions.js
using -> for concise functions and → for TCP functions
View short-functions.js
// 1. Shorter function syntax.
//
// This version does not respect "Tennent's correspondence principle" -- it's nothing
// more than syntactic sugar for the traditional function syntax. That means when you
// see the normal braced body of a function, whether it's a longhand function or this
// shorthand version, there's no difference: return, this, and arguments are all tied
// to the new function body, and there's no implicit returning of the last expression
// result.
a.some((x) {
@frewsxcv
frewsxcv / short-functions.js
Created Mar 10, 2012 — forked from dherman/short-functions.js
using -> for concise functions and => for TCP functions
View short-functions.js
// non-TCP, shorter function
a.some((x) {
if (invalid(x))
return true;
console.log(x);
})
// maximally concise, implicit return
a.map((x) x * 17)
@frewsxcv
frewsxcv / gist:1628357
Created Jan 17, 2012 — forked from oeon/oam.sh
OAM batch script
View gist:1628357
#!/bin/sh
export GDAL_TIFF_INTERNAL_MASK=YES
for f in /media/LAR_HD/6Inch/*.tif
do
nearblack -co TILED=YES -setmask -nb 0 -of GTiff -o ./prewarp.tif $f
gdalwarp -co TILED=YES -dstalpha -s_srs EPSG:2229 -t_srs EPSG:4326 prewarp.tif warped.tif
rm prewarp.tif
gdal_translate -co TILED=YES -co JPEG_QUALITY=80 -co COMPRESS=JPEG -co PHOTOMETRIC=YCBCR -b 1 -b 2 -b 3 -mask 4 warped.tif final.tif
@frewsxcv
frewsxcv / gist:1262862
Created Oct 4, 2011
San Luis Obispo translation file (ogr2osm)
View gist:1262862
def translateAttributes(attrs):
if not attrs:
return
tags = {}
if int(attrs['SPD_PST']) > 0:
tags.update({'maxspeed':attrs['SPD_PST'] + ' mph'})
if attrs['FULLNAME']:
tags.update({'name:fullname':attrs['FULLNAME'],'source:maxspeed':'sign' })
@frewsxcv
frewsxcv / gist:1262533
Created Oct 4, 2011
San Luis Obispo translation file (ogr2osm)
View gist:1262533
def translateAttributes(attrs):
if not attrs:
return
tags = {}
if int(attrs['SPD_PST']) > 0:
tags.update({'maxspeed':attrs['SPD_PST'] + ' mph'})
if attrs['FULLNAME']:
tags.update({'name:fullname':attrs['FULLNAME'] })
You can’t perform that action at this time.