Skip to content

Instantly share code, notes, and snippets.

Avatar

Ivan Lokhov ilokhov

View GitHub Profile
@ilokhov
ilokhov / github-api-search.js
Created Dec 22, 2019
Node.js script for querying GitHub Search API v3
View github-api-search.js
// API docs: https://developer.github.com/v3/search/
// search docs: https://help.github.com/en/github/searching-for-information-on-github/searching-on-github
// you might have to limit the number of requests
// if trying to send too many at once
const request = require('request');
const _ = require('lodash');
const fs = require('fs');
@ilokhov
ilokhov / nominatim-reverse-geocode.js
Created Dec 8, 2019
Node.js script for querying city districts for a list of geo coordinates using Nominatim API
View nominatim-reverse-geocode.js
const fs = require('fs');
const request = require('request');
const customHeaderRequest = request.defaults({
headers: { 'User-Agent': 'Reverse geocode search' }
});
let output = '';
// expected input format in input_data.csv
@ilokhov
ilokhov / inject-ie-grid.js
Created Mar 9, 2019
JS script which injects a stylesheet with prefixed CSS grid properties for Internet Explorer
View inject-ie-grid.js
const ua = window.navigator.userAgent;
const isIE = /MSIE|Trident/.test(ua);
if (!isIE) return;
const styleElement = document.createElement("style");
styleElement.setAttribute("type", "text/css");
const grid = { rows: 2, cols: 4 };
let styleContent = `#grid {display: -ms-grid; -ms-grid-columns: (1fr)[${grid.cols}]; -ms-grid-rows: (1fr)[${grid.rows}];}`;
@ilokhov
ilokhov / export-sync-bookmarks.js
Last active Jan 25, 2021
Node.js script for exporting and synchronising bookmarks from Google Chrome
View export-sync-bookmarks.js
const fs = require("fs");
const path = require("path");
function newItem(name, url) {
return { name, url };
}
const bookmarkPath = path.join(
process.env.HOME,
"/Library/Application Support/Google/Chrome/Default/Bookmarks"
@ilokhov
ilokhov / build
Created Apr 2, 2018
Build shell script for personal website
View build
#!/bin/bash
# clean dist directory and copy all files from src
rm -rf dist && mkdir dist
cp -a src/. dist/
### images
# declare sizes
declare -a sizes=('710' '1000' '1420')