Skip to content

Instantly share code, notes, and snippets.

View stepankuzmin's full-sized avatar
🥡

Stepan Kuzmin stepankuzmin

🥡
View GitHub Profile
(defn fib [n] (match [n]
[0] 1
[1] 1
:else (+ (fib (- n 1)) (fib (- n 2)))))
@stepankuzmin
stepankuzmin / gist:8708285
Created January 30, 2014 13:28
Leaflet — wrap GeoJSON around date line (antimeredian)
var map = L.map('map').setView([50, 100], 2);
L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {continuousWorld: false}).addTo(map);
$.getJSON("data/russia-federative-division-0.1.geojson", function (data) {
L.geoJson(data, {
coordsToLatLng: function (coords) {
longitude = coords[0];
latitude = coords[1];
var container;
var camera, scene, renderer;
var group;
var radius = 200;
var mouseX = 0, mouseY = 0;
var width = 700;
var height = 700;
var windowHalfX = width / 2;
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@stepankuzmin
stepankuzmin / gist:d23c1cf7f10dd4c6db17
Created August 19, 2014 11:02
Jekyll posts by tag
{% for post in site.posts %}
{% for tag in post.tags %}
{% if tag == "star" %}
{{post.title}}
{% endif %}
{% endfor %}
{% endfor %}
@stepankuzmin
stepankuzmin / gist:df08467e9d136a7b1e57
Created August 20, 2014 14:56
Filter Jekyll pages
{% assign starred = site.posts | where: "star", true %}
{% for post in starred %}
{{post.title}}
{% endfor %}
@stepankuzmin
stepankuzmin / image-with-linear-gradient.styl
Created January 16, 2015 07:43
Stylus background image with linear-gradient mixin
@import 'nib'
image-with-linear-gradient(url, linear-gradient-arguments...)
error('image url required') unless length(url)
background-image url(url), unquote('linear-gradient(' + join(', ',linear-gradient-arguments) + ')')
@stepankuzmin
stepankuzmin / convert.sh
Last active August 29, 2015 14:19
Filter power from osm.pbf to geojson
#!/bin/bash
# Convert to osm xml
for file in *.osm.pbf; do
echo "Converting $file to ${file%.pbf}"
./osmconvert $file > ${file%.pbf}
done
# Filter power=line
for file in *.osm; do
@stepankuzmin
stepankuzmin / markdown.sh
Last active August 29, 2015 14:20
*.rb and *.coffee sources as markdown
#!/bin/bash
find app \( -iname "*.rb" -o -iname "*.coffee" \) -exec awk 'BEGIN {printf("\n*%s*\n", ARGV[1]); printf("\n```\n")} {printf("\t%s\n", $0)} END{printf("```\n")}' "{}" \; > source.md
@stepankuzmin
stepankuzmin / iterableFileList.js
Created June 24, 2015 12:53
Babel.js iterable FileList
function iterableFileList(fileList) {
return Object.assign({
__proto__: fileList.__proto__,
[Symbol.iterator]() {
let nextIndex = 0;
return {
next() {
return nextIndex < fileList.length ?
{done: false, value: fileList[nextIndex++]} :
{done: true};