Skip to content

Instantly share code, notes, and snippets.

View allthesignals's full-sized avatar
🥑
coding lotsa code

Matt Gardner allthesignals

🥑
coding lotsa code
View GitHub Profile
{{#mapbox-gl class='map-container' initOptions=(hash pitch=30) as |map|}}
{{#map.source options=(hash type='geojson' data=data) as |source|}}
{{source.layer layer=(hash
type='line'
paint=(hash line-color='#007cbf' line-width=10))}}
{{/map.source}}
{{/mapbox-gl}}
{{bike-lane-map data=model}}
{{outlet}}
{{log model}}
{{#mapbox-gl class='map-container' initOptions=(hash pitch=30) as |map|}}
{{#map.source options=(hash type='geojson' data=model) as |source|}}
{{source.layer layer=(hash
type='line'
paint=(hash line-color='#007cbf' line-width=10))}}
{{/map.source}}
{{/mapbox-gl}}
@allthesignals
allthesignals / tutorial_chicago_bike_routes.geojson
Created July 23, 2018 16:32
GeoJSON of Chicago Bike Lanes
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
{{#filter-section
filterTitle='Borough / Block'
appliedFilters=applied-filters
filterNames=(array 'boroughs' 'block')
mutateArray=(action 'mutateArray')
as |section|
}}
<ul class="menu vertical medium-horizontal stage-checkbox">
{{#each (array 'Citywide' 'Manhattan' 'Bronx' 'Brooklyn' 'Queens' 'Staten Island') as |type|}}
<li {{action section.delegate-mutation (action 'mutateArray' 'boroughs' type)}}>
@allthesignals
allthesignals / gist:fe1892bcaaa2d01015efe24d9cc21192
Last active June 23, 2018 17:51 — forked from chriswhong/gist:762ceac7fb8a1420e7e7adceb770b707
Using ST_AsMVT() and ST_AsMVTGeom() in express to build a vector tile endpoint
/* GET /tiles/:z/:x/:y.mvt */
/* Retreive a vector tile by tileid */
router.get('/tiles/:z/:x/:y.mvt', async (req, res) => {
const { z, x, y } = req.params;
// calculate the bounding polygon for this tile
const bbox = mercator.bbox(x, y, z, false);
// Query the database, using ST_AsMVTGeom() to clip the geometries
// Wrap the whole query with ST_AsMVT(), which will create a protocol buffer
export default class ProjectsMapComponent extends Component {
@restartableTask
projectCentroidsSource = function*() {
const sourceLayers = [{
id: 'project-centroids',
sql: 'SELECT * FROM project_centroids',
}];
const tileURL = yield carto.getVectorTileTemplate(sourceLayers);
import { module, test, skip } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render, find, click } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
module('Integration | Component | layer-menu-item', function(hooks) {
setupRenderingTest(hooks);
test('it opens and closes on click', async function(assert) {
await render(hbs`{{layer-menu-item title='Foo'}}`);
/**
@module Discourse
*/
var get = Ember.get, set = Ember.set;
var popstateFired = false;
var supportsHistoryState = window.history && 'state' in window.history;
// Thanks: https://gist.github.com/kares/956897
var re = /([^&=]+)=?([^&]*)/g;
@allthesignals
allthesignals / dynamic-query-params.js
Created April 30, 2018 19:29
Aliased & observed properties from a collection of models
import Service from '@ember/service';
import EmberObject from '@ember/object';
import { alias } from '@ember/object/computed';
export default class DynamicQueryParamsService extends Service {
setup(expected, received) {
// map and alias model prop references to public properties
const aliasedObjectMap = expected
.reduce((acc, layerGroup) => {
const id = layerGroup.get('id');