Skip to content

Instantly share code, notes, and snippets.

View patrickarlt's full-sized avatar

Patrick Arlt patrickarlt

View GitHub Profile
export default function log (target, name, descriptor) {
let fn = descriptor.value;
descriptor.value = function (...args) {
console.log('calling', name, 'with', args);
try {
let out = fn.apply(this, args);
console.log('got', out);
return out;
} catch (e) {
/* jshint node: true */
module.exports = function(environment) {
var ENV = {
modulePrefix: 'ember-app',
environment: environment,
baseURL: '/',
locationType: 'auto',
EmberENV: {
FEATURES: {
// make a feature group to store lots of markers and add it to the map
var markers = new L.featureGroup().addTo(map);
// listen for clicks on things in the feature group
markers.on("click", function(e){
// e.target is the marker which should have an "id" property
});
// in theory you do this a bunch of times
var marker = new L.marker(latlng, options);
map.on("load", function(){
map.disableMapNavigation();
map.enableRubberBandZoom();
map.enableDoubleClickZoom();
map.enablePan();
});
<!doctype html>
<html>
<head>
</head>
<body>
<script src="dojo/dojo.js.uncompressed.js"></script>
<script>
require(["dojo/Deferred"], function(Deferred){
var deferred = new Deferred();
@patrickarlt
patrickarlt / app.js
Created February 26, 2014 02:48
Robust unique ids in Leaflet
var MyMarkerGroup = L.FeatureGroup.extend({
// override the 'getLayerId' function to return your ids rather then leaflets internal ids
getLayerId: function(layer){
return layer.id;
}
getLayersById: function(arrayOfLayerIds){
var layers = [];
// some logic to loop over layers and select them by id
// leaflet maintains layers (markers) in an internal _layers property
@patrickarlt
patrickarlt / SassMeister-input-HTML.html
Created March 2, 2014 20:32
Generated by SassMeister.com.
<h1>Header</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras eros quam, ultrices ac dictum ac, fringilla at leo. Etiam at est pulvinar, pulvinar quam sed, rhoncus nisl. In cursus eleifend ligula, eu posuere sapien sollicitudin non. Fusce consequat, leo quis auctor pharetra, felis urna condimentum dolor, ac suscipit tellus est aliquet nibh.</p>
@patrickarlt
patrickarlt / SassMeister-input-HTML.html
Created March 2, 2014 20:35
Generated by SassMeister.com.
<a class="button">Button</a>
<a class="button danger-zone">Button</a>
@patrickarlt
patrickarlt / SassMeister-input.scss
Created March 2, 2014 21:32
Generated by SassMeister.com.
// ----
// Sass (v3.2.14)
// Compass (v0.12.2)
// ----
html {
width: 100%;
height: 100%;
body {
width: 100%;
@patrickarlt
patrickarlt / SassMeister-input.scss
Created March 2, 2014 21:36
Generated by SassMeister.com.
// ----
// Sass (v3.2.14)
// Compass (v0.12.2)
// ----
html, body, .app {
width: 100%;
}
html, body, .app, .map, .sidebar {