Skip to content

Instantly share code, notes, and snippets.

View ilokhov's full-sized avatar

Ivan Lokhov ilokhov

View GitHub Profile
@ilokhov
ilokhov / github-api-search.js
Created December 22, 2019 10:33
Node.js script for querying GitHub Search API v3
// 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 December 8, 2019 19:51
Node.js script for querying city districts for a list of geo coordinates using Nominatim API
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 March 9, 2019 23:37
JS script which injects a stylesheet with prefixed CSS grid properties for Internet Explorer
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 September 30, 2024 11:44
Node.js script for exporting and synchronising bookmarks from Google Chrome
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 April 2, 2018 20:04
Build shell script for personal website
#!/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')