Skip to content

Instantly share code, notes, and snippets.

View jczaplew's full-sized avatar

John J Czaplewski jczaplew

View GitHub Profile
document.querySelector('#g-model-promo.hp-promo-ccol .g-trump .g-label').style.float = 'none'
"none";
document.querySelector('#g-model-promo.hp-promo-ccol .g-trump .g-label').style.position = 'absolute';
document.querySelector('#g-model-promo.hp-promo-ccol .g-trump .g-label').style.right = '-5px'
"-5px";
@jczaplew
jczaplew / Data.txt
Created April 13, 2016 16:49
PostGIS vs shapely union
Download this - http://www.geologyontario.mndmf.gov.on.ca/mndmfiles/pub/data/imaging/MRD126-REV1//MRD126-REV1.zip
@jczaplew
jczaplew / redis-cheatsheet.md
Last active March 17, 2016 15:32
Redis cheatsheet

Standard port: 6379

Config file:

  • Homebrew - /usr/local/etc/redis.conf
  • Macports - /opt/local/etc/redis.conf

Start redis

redis-server [path to config file]

@jczaplew
jczaplew / direction.js
Created March 8, 2016 03:21
Heading to direction
function getCardinalDirection(heading) {
// Principle winds + half-winds defintions via https://en.wikipedia.org/wiki/Points_of_the_compass
// 22.49deg between each step
switch(true) {
case (heading >= 348.76 || heading <= 11.25):
return 'N';
case heading >= 11.26 && heading <= 33.75:
return 'NNE';
case heading >= 33.76 && heading <= 56.25:
return 'NE';
javascript:(function(e,a,g,h,f,c,b,d)%7Bif(!(f=e.jQuery)%7C%7Cg%3Ef.fn.jquery%7C%7Ch(f))%7Bc=a.createElement(%22script%22);c.type=%22text/javascript%22;c.src=%22http://ajax.googleapis.com/ajax/libs/jquery/%22+g+%22/jquery.min.js%22;c.onload=c.onreadystatechange=function()%7Bif(!b&&(!(d=this.readyState)%7C%7Cd==%22loaded%22%7C%7Cd==%22complete%22))%7Bh((f=e.jQuery).noConflict(1),b=1);f(c).remove()%7D%7D;a.documentElement.childNodes%5B0%5D.appendChild(c)%7D%7D)(window,document,%221.3.2%22,function($,L)%7B$('%23header,%20.pagehead,%20.breadcrumb,%20.commit,%20.meta,%20%23footer,%20%23footer-push,%20.wiki-actions,%20%23last-edit,%20.actions,%20.header,.site-footer,.repository-sidebar,.file-navigation,.gh-header-meta,.gh-header-actions,#wiki-rightbar,#wiki-footer,.commit-tease').remove();%20$('%23files,%20.file').css(%7B%22background%22:%22none%22,%20%22border%22:%22none%22%7D);%20$('link').removeAttr('media');%7D); var removeMe = document.getElementsByClassName("file-header")[0]; removeMe.parentNode.removeChild(r
-- Doesn't work
SELECT ST_Buffer(ST_Segmentize('LINESTRING(-88 45,-90 43)'::geography, 1000), 1);
/*
* ERROR: transform: couldn't project point (-88 45 0): latitude or longitude exceeded limits (-14)
* CONTEXT: SQL function "st_buffer" statement 1
* Query failed
* PostgreSQL said: transform: couldn't project point (-88 45 0): latitude or longitude exceeded limits (-14)
*/
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width" charset="UTF-8">
<title>Simplest mapping app</title>
<link rel="stylesheet" href="http://maps.metastudio.org/lib/leaflet/Leaflet-1.0.0-b2/leaflet.css" />
<style>
body {
padding:0;
margin:0;
@jczaplew
jczaplew / bestTextColor.js
Last active December 21, 2015 19:55
Best color for text on a background of a given hex color
/*
Variation of http://stackoverflow.com/a/11508164/1956065
Follow up to https://twitter.com/johnjcz/status/670365691329970176
Inspired by UI of http://www.colorhexa.com/
*/
function bestTextColor(hex) {
hex = hex.replace('#', '');
var bigint = parseInt(hex, 16);
@jczaplew
jczaplew / index.html
Last active October 20, 2015 22:19
Brute Force
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width" charset="utf-8">
<title>Brute force</title>
<style>
body {
padding: 0;
margin: 0;
@jczaplew
jczaplew / odd.geojson
Created October 1, 2015 03:31
Problematic polygon
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.