Skip to content

Instantly share code, notes, and snippets.

@spara
spara / geo_header_to_postgres.sql
Created January 10, 2012 20:22
Import 2010 Census geo_header file into Postgresql
INSERT INTO geo_header_sf1 (fileid, stusab, sumlev, geocomp, chariter, cifsn, logrecno, region, division, state, county, countycc, countysc, cousub, cousubcc, cousubsc, place, placecc, placesc, tract, blkgrp, block, iuc, concit, concitcc, concitsc, aianhh, aianhhfp, aianhhcc, aihhtli, aitsce, aits, aitscc, ttract, tblkgrp, anrc, anrccc, cbsa, cbsasc, metdiv, csa, necta, nectasc, nectadiv, cnecta, cbsapci, nectapci, ua, uasc, uatype, ur, cd, sldu, sldl, vtd, vtdi, reserve2, zcta5, submcd, submcdcc, sdelem, sdsec, sduni, arealand, areawatr, name, funcstat, gcuni, pop100, hu100, intptlat, intptlon, lsadc, partflag, reserve3, uga, statens, countyns, cousubns, placens, concitns, aianhhns, aitsns, anrcns, submcdns, cd113, cd114, cd115, sldu2, sldu3, sldu4, sldl2, sldl3, sldl4, aianhhsc, csasc, cnectasc, memi, nmemi, puma, reserved)
SELECT
trim(substring(data,1,6)) AS fileid,
trim(substring(data,7,2)) AS stusab,
trim(substring(data,9,3)) AS sumlev,
trim(substring(data,12,2)) AS geocomp,
trim(substring(data,14,3)) AS
@spara
spara / create_SF1_tables.sql
Created January 10, 2012 20:25
Create 2010 Census SF1 tables
-- drop table data_field_descriptors;
create table data_field_descriptors
(
sort id integer,
segment varchar(4),
table number varchar(12),
field name varchar(510),
field code varchar(20),
decimal integer
);
@spara
spara / create_geo_header_staging_table.sql
Created January 10, 2012 20:27
Create staging table for geo_header data
CREATE TABLE geo_header_staging(data text);
copy geo_header_staging FROM '/path/to/dcgeo2010.sf1' DELIMITER AS '|';
@semprebon
semprebon / gist:1595446
Created January 11, 2012 16:24
Dynspag Layer
{
"guid": "15fa1134cd6a24a5",
"title": "Hospitals",
"categoryFilter": null,
"url_type": null,
"extent": [ - 170.685669787886, -14.2903264751727, 145.724048653947, 71.2930611100571],
"info_window_filter": null,
"subtitle": "",
"geometry_types": ["point"],
"order": 1,
@sgillies
sgillies / geojson-is-spectacularly-wrong.rst
Last active December 12, 2015 08:39
Candidate talks for http://foss4g-na.org/call-for-presentations/. Comments and forks welcome. I'm also open to co-presenting.

GeoJSON is Spectacularly Wrong

Sean Gillies http://sgillies.net

This work is licensed under the Creative Commons Attribution 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by/3.0/ or send a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA.

anonymous
anonymous / index.html
Created May 12, 2014 01:09
A Pen by Anonasaurus Rex.
<div id="mydiv" class="container">
<h1 style="color:orange">Hello</h1>
<p id="name">My name is Vivian</p>
I like
<ul>
<li class="yes">books</li>
<li>bugs</li>
<li>cats</li>
<li class="no">dogs</li>
</ul>
@bradtraversy
bradtraversy / myscript.sh
Last active July 16, 2024 10:39
Basic Shell Scripting
#! /bin/bash
# ECHO COMMAND
# echo Hello World!
# VARIABLES
# Uppercase by convention
# Letters, numbers, underscores
NAME="Bob"
# echo "My name is $NAME"
@iansu
iansu / README.md
Last active March 1, 2021 08:40
Create React App 4.0 Alpha Testing

Create New App

JavaScript Template

npx create-react-app@next --scripts-version=@next --template=cra-template@next my-js-app

TypeScript Template

npx create-react-app@next --scripts-version=@next --template=typescript@next my-ts-app

@michalczukm
michalczukm / move-exercises-to-ts.sh
Created April 12, 2021 17:07
Moves js exercises files to TS - so now you can do the examples in TS
#!/bin/sh
npm install -D typescript @types/node @types/react @types/react-dom @types/jest
echo "{
"compilerOptions": {
"target": "ESNext",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
@DavidWells
DavidWells / javascript-proxy-as-rest-client.js
Last active May 12, 2024 14:24
Using a javascript proxy as low code REST client
/* Using a JavaScript proxy for a super low code REST client */
// via https://dev.to/dipsaus9/javascript-lets-create-aproxy-19hg
// also see https://towardsdatascience.com/why-to-use-javascript-proxy-5cdc69d943e3
// also see https://github.com/fastify/manifetch
// also see https://github.com/flash-oss/allserver
// and https://gist.github.com/v1vendi/75d5e5dad7a2d1ef3fcb48234e4528cb
const createApi = (url) => {
return new Proxy({}, {
get(target, key) {