Skip to content

Instantly share code, notes, and snippets.

const map = new mapboxgl.Map(mergedOptions)
map.on("style.load", function () {
map.setFilter("layer-with-polygons", [
"==",
["get", "City"],
"Budapest",
])
})
map.on("load", () => {
let features = map.querySourceFeatures("composite", {
@guy-kdm
guy-kdm / gil-api.js
Created February 16, 2020 13:30
for gil to look at fn=> fn as opposed to a => fn('', a)
const Airtable = require('airtable');
const fs = require('fs');
const AIRTABLE_API_KEY = 'keybqbYGu7ewvtNfh';
Airtable.configure({ apiKey: AIRTABLE_API_KEY, endpointUrl: 'https://api.airtable.com' });
const tableId = 'applVr5WzyjAo4xZS';
const base = Airtable.base(tableId);
const groupBy = (arr, groupByField) => {
return arr.reduce((acc, item) => {
@guy-kdm
guy-kdm / fix-wrong-layout-typed
Last active November 16, 2019 19:14
Speak two languages? Use two keyboard layouts and often start typing using the wrong one? If you're using Gnome keybind this script (super+space on my macine) and invoke to retype using the correct layout. Only Hebrew is supported but it's very easy to adapt to other layouts, just change ISL variable to your layout.
#!/bin/bash
USL="tcdsvuzjyhfknbxgpmera,.;oil[]wq\/'"
ISL="אבגדהוזחטיכלמנסעפצקרשתץףםןך]['\/.,"
CURRENT=`nohup gdbus call --session --dest org.gnome.Shell --object-path /org/gnome/Shell --method org.gnome.Shell.Eval "imports.ui.status.keyboard.getInputSourceManager().currentSource.index"`
xdotool sleep 0.125 getwindowfocus key Shift+Home
if [ "$CURRENT" == "(true, '1')" ]; then
@guy-kdm
guy-kdm / .hyper.js
Created October 12, 2017 13:15
hyper.js
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// default font size in pixels for all tabs
fontSize: 12,
// font family with optional fallbacks
@guy-kdm
guy-kdm / chunkedExecution.js
Last active August 21, 2017 10:31
Chunked execution of async functions
/**
* Serially executes a promise returning function over an array of inputs,
* Each time waiting for {chunkSize} inputs execution to resolve before
* executing fn over the next inputs chunk.
* @param {A promise returning function} fn
* @param {Number} chunkSize
* @param {An array where each item is an input to fn} inputs
*/
function chunkedExecution(fn, chunkSize, inputs) {
const chunks = R.splitEvery(chunkSize, inputs);
import React from "react";
function getAllInputs(target) {
const domData = new FormData(target);
const data = {};
[...domData.keys()].forEach(key => data[key] = domData.get(key));
return data;
}
function getSingleInput(target) {
@guy-kdm
guy-kdm / package.json
Created October 22, 2016 09:12
storybook bug?
{
"name": "grumshi",
"version": "0.1.0",
"private": true,
"devDependencies": {
"@kadira/storybook": "^2.21.0",
"algebra.js": "^0.2.5",
"chai": "^3.5.0",
"enzyme": "^2.4.1",
"react-addons-test-utils": "^15.3.2",