Skip to content

Instantly share code, notes, and snippets.

View jameslaneconkling's full-sized avatar

James Conkling jameslaneconkling

View GitHub Profile
@jameslaneconkling
jameslaneconkling / mb_grid-tile_control
Last active August 29, 2015 14:00
function to toggle layers and grid on/off [modified from https://www.mapbox.com/mapbox.js/example/v1.0.0/layers/]
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Layers</title>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox.js/v1.6.2/mapbox.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox.js/v1.6.2/mapbox.css' rel='stylesheet' />
@jameslaneconkling
jameslaneconkling / leaflet_grid-tile_control
Last active August 29, 2015 14:01
adding/removing grid layers using L.control.layers() control
<script type='text/javascript'>
//JLC additions
gridControls = {}
var map = L.mapbox.map('map', 'geointerest.map-dqz2pa8r', { zoomControl: false }).setView([17.1456, -87.0029], 8);
map.options.maxZoom = 13;map.options.minZoom = 6;
map.legendControl.addLegend(document.getElementById('legend-content').innerHTML);
new L.Control.Zoom({ position: 'topleft' }).addTo(map);
L.control.scale({ position: 'bottomleft' }).addTo(map);
@jameslaneconkling
jameslaneconkling / gist:2e23a3f25f59a829ed31
Last active August 29, 2015 14:17
Test ajax requests
<!doctype html>
<html class="no-js" lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no" />
</head>
<body>
<h1>Testing Ajax</h1>
@jameslaneconkling
jameslaneconkling / README.md
Last active August 8, 2017 20:23
Simple React-Falcor bindings to connect your components to your falcor graph.

React Falcor Bindings

A simple rxjs-powered Higher Order Component to bind React views to the Falcor graph.

The intent here is to allow for GraphQL/Relay-esque declarative data fetching at the component level, without requiring an entire framework for support. This means the HOC bindings should play well along side other data model frameworks like Redux.

The HOC works by running queries against a falcor model, and merging the result stream into a component's props, specifically by injecting the props graphFragment (containing the query result) and graphFragmentStatus (containing the string next, complete or error).

const TodosList = ({ from, to, graphFragment, graphFragmentStatus }) => {
@jameslaneconkling
jameslaneconkling / index.html
Created July 18, 2017 15:44
React-Router@5 Template
<div id="root">
</div>
@jameslaneconkling
jameslaneconkling / myriahedron.js
Created October 18, 2017 01:55
generate and project a myriahedral grid onto the globe, in the style of Buckminster Fuller's famous Dymaxion map
const {
Readable
} = require('stream');
const {
readFileSync
} = require('fs');
const degrees2Radians = degrees => degrees * (Math.PI / 180);
const radians2Degrees = radians => radians * (180 / Math.PI);
@jameslaneconkling
jameslaneconkling / baby-lisper.js
Last active August 23, 2022 00:32
A silly simple lisp parser in javascript
const rules = [
{ type: 'space', regex: /^\s/ },
{ type: 'lParen', regex: /^\(/ },
{ type: 'rParen', regex: /^\)/ },
{ type: 'number', regex: /^[0-9\.]+/ },
{ type: 'string', regex: /^".*?"/ },
{ type: 'variable', regex: /^[^\s\(\)]+/ } // take from the beginning 1+ characters until you hit a ' ', '(', or ')' // TODO - support escaped double quote
];

Keybase proof

I hereby claim:

  • I am jameslaneconkling on github.
  • I am jamesconkling (https://keybase.io/jamesconkling) on keybase.
  • I have a public key ASCc-FGMMDEh65-d33v94EkI9nc7Ydc_u_D-2YnqbD73_go

To claim this, I am signing this object:

@jameslaneconkling
jameslaneconkling / .spacemacs
Last active March 21, 2018 23:28
Spacemacs Config for Clojure(script), Javascript
;; -*- mode: emacs-lisp -*-
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
(setq-default
;; Base distribution to use. This is a layer contained in the directory
@jameslaneconkling
jameslaneconkling / y-combinator.js
Last active March 19, 2018 20:54
An implementation of the Y Combinator in Javascript
const Y = (fn) => (
(_fn) => fn((arg) => (_fn(_fn))(arg))
)(
(__fn) => fn((arg) => (__fn(__fn))(arg))
);
var factorial = (fact) => (n) => n === 0 ? 1 : n * fact(n - 1);
Y(factorial)(7);
//> 5040