Skip to content

Instantly share code, notes, and snippets.

Avatar
🐫
Copyright 1987-2013, Larry Wall

Jon Williams WIZARDISHUNGRY

🐫
Copyright 1987-2013, Larry Wall
View GitHub Profile
@WIZARDISHUNGRY
WIZARDISHUNGRY / fun.js
Last active Aug 29, 2015
fun javscript stuff I made
View fun.js
/*
scroll an infinite scrolling window forever
*/
var pos=-1; var f = function() { if(pos==document.body.scrollHeight) return; window.scrollTo(0,document.body.scrollHeight); pos=document.body.scrollHeight; window.setTimeout(f, 1000); }; f();
View modulargrid.net.sh
#!/bin/bash
grep /e/ ~/Desktop/Users\ on\ ModularGrid.html | sed 's/.*href="\([^"]*\)".*/\1/' | grep http | grep /e/modules/view | xargs -n 1 -P 10 curl -kL 2> /dev/null |grep '<meta.*desc' | sed 's#.*<meta name="description" content="\(.*\) - .* Module \(.*\)" />.*#\1 \2#' | sort | tee module-list.txt
View index.js
$.index.open();
$.webView.url = "http://www.yahoo.com/";
$.webView.addEventListener('beforeload', function(e) {
alert("beforeload "+ e.url);
e.cancelBubble = true;
});
$.webView.addEventListener('load', function(e) {
alert("load "+ e.url);
e.cancelBubble = true;
});
View DID-YOU-EVER-HEAR-OF-GETOPTS.php
<?php
function parseArgs($argv){
array_shift($argv); $o = array();
foreach ($argv as $a){
if (substr($a,0,2) == '--'){ $eq = strpos($a,'=');
if ($eq !== false){ $o[substr($a,2,$eq-2)] = substr($a,$eq+1); }
else { $k = substr($a,2); if (!isset($o[$k])){ $o[$k] = true; } } }
else if (substr($a,0,1) == '-'){
if (substr($a,2,1) == '='){ $o[substr($a,1,1)] = substr($a,3); }
else { foreach (str_split(substr($a,1)) as $k){ if (!isset($o[$k])){ $o[$k] = true; } } } }
@WIZARDISHUNGRY
WIZARDISHUNGRY / Case.php
Last active Aug 29, 2015
testcase for phpunit process isolation bug
View Case.php
<?php
/**
* @runTestsInSeparateProcesses
*/
class MyCase extends PHPUnit_Framework_TestCase
{
public function testWhatHappensNext()
{
//sleep(10);
@WIZARDISHUNGRY
WIZARDISHUNGRY / xmpp_ebooks.rb
Last active Aug 29, 2015
facebook / xmpp ebooks
View xmpp_ebooks.rb
#!/usr/bin/env ruby
require 'xmpp4r'
require 'xmpp4r/client'
require 'xmpp4r/roster'
require 'twitter_ebooks'
include Jabber
class Bot
View blocked-tweet-sponsors.txt
blocking ThanksUSA
blocking phunware
blocking NRGDavidCrane
blocking RayTinnenyFit
blocking r17dotcom
blocking Wix
blocking smartling
blocking IntelITCenter
blocking DellBigData
blocking airpair
View ansi2html.sh
#!/bin/sh
# Convert ANSI (terminal) colours and attributes to HTML
# Licence: LGPLv2
# Author:
# http://www.pixelbeat.org/docs/terminal_colours/
# Examples:
# ls -l --color=always | ansi2html.sh > ls.html
# git show --color | ansi2html.sh > last_change.html
View everyword-2014.txt
This file has been truncated, but you can view the full file.
étui
études
étude
étagères
étagère
épées
épée
émigrés
émigré
View nycneighborhoods.md

Download and convert data from NYC open data portal

curl -o nynta.zip "https://nycopendata.socrata.com/api/geospatial/cpf4-rkhq?method=export&format=Shapefile"
cd nynta_12c

ogr2ogr can't deal with the projection directly. Replace content of nynta.prj with the following projection string:

PROJCS["NAD_1983_StatePlane_New_York_Long_Island_FIPS_3104_Feet",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["lambert_conformal_conic_2sp"],PARAMETER["False_Easting",984250.0],PARAMETER["False_Northing",0.0],PARAMETER["longitude_of_center",-74.0],PARAMETER["Standard_Parallel_1",40.66666666666666],PARAMETER["Standard_Parallel_2",41.03333333333333],PARAMETER["latitude_of_center",40.16666666666666],UNIT["Foot_US",0.3048006096012192]]