Skip to content

Instantly share code, notes, and snippets.

Avatar

David Clark davidtheclark

View GitHub Profile
View react-examples.jsx
// Simplest component: stateless function.
function Hello(props) {
return (
<div className="txt-bold">
Hello {props.name}
</div>
);
}
// Without JSX.
View extract-rendered-geojson.js
'use strict';
const mapnik = require('mapnik');
const VectorTile = require('vector-tile').VectorTile;
const Protobuf = require('pbf');
const fs = require('fs');
mapnik.register_default_input_plugins();
const geojson = fs.readFileSync('original-russian-triangle.geojson', 'utf8');
View example-tile-geojson-extraction.js
var VectorTile = require('vector-tile').VectorTile;
var Protobuf = require('pbf');
var fs = require('fs');
var path = require('path');
var data = fs.readFileSync(path.join(__dirname, './pbfs/river.vector.pbf'));
var tile = new VectorTile(new Protobuf(data));
var layer = tile.layers['russian-river'];
View bs.js
'use strict';
var fs = require('graceful-fs');
var Promise = require('pinkie-promise');
var yaml = require('js-yaml');
var parseJson = require('parse-json');
var requireFromString = require('require-from-string');
module.exports = function(configPath, configFormat) {
return new Promise(function(resolve) {
View bundle.js
var pathmodify = require('pathmodify')
var browserify = require('browserify')
browserify('./index.js')
.plugin(pathmodify(), {
mods: [
pathmodify.mod.dir('foo', './test/foo')
]
})
.bundle();
@davidtheclark
davidtheclark / idea.md
Last active Aug 29, 2015
available browser info module idea
View idea.md

There are several modules that do the following:

  1. locate available browsers on the current machine;
  2. do something with that information.

Usually #2 is "launch the browser with some specific content", but not always.

The modules I have in mind (of course there may be more!) are:

View .scss-lint.yml
# For SCSS-Lint v0.31.0
linters:
BangFormat:
enabled: true
space_before_bang: true
space_after_bang: false
BorderZero:
@davidtheclark
davidtheclark / snippet.cson
Last active Jan 31, 2019
Freemarker snippets for Atom Editor
View snippet.cson
# First install Freemarker language support with https://github.com/niltonheck/language-freemarker
'.text.html.ftl':
'Freemarker if':
'prefix': 'if'
'body': """
[#if ${1:condition}]
$2
[/#if]
"""
@davidtheclark
davidtheclark / SassMeister-input.scss
Created Aug 2, 2014
Generated by SassMeister.com.
View SassMeister-input.scss
// ----
// libsass (v2.0.0)
// ----
@mixin first {
/* first mixin was included */
body {
font-size: 100px;
}
}
@davidtheclark
davidtheclark / test-extends.scss
Created Apr 5, 2014
for comparing gzipping of Sass extends and mixins
View test-extends.scss
@import "../bower_components/scut/dist/scut";
@for $i from 1 through 200 {
.test-#{$i} {
@extend %scut-hide-visually;
@extend %scut-image-replace;
@extend %scut-triangle;
@extend %scut-clearfix;
@extend %scut-fill;
@extend %scut-list-unstyled;