Skip to content

Instantly share code, notes, and snippets.

View hello.user.js
// ==UserScript==
// @name New Userscript
// @namespace http://tampermonkey.net/
// @version 0.1.1
// @description try to take over the world!
// @author You
// @match http://*/*
// @match https://*/*
// @grant none
// ==/UserScript==
View jsParseDate.js
// @see https://habr.com/ru/post/204628/
// @see http://jsfiddle.net/Imater/5Lqx7/
//парсер даты (позвонить послезавтра)
function jsParseDate(title) {
title = title.replace('одинадцать', '11')
.replace('двенадцать', '12')
.replace('тринадцать', '13')
.replace('четырнадцать', '14')
.replace('пятнадцать', '15')
@Gvozd
Gvozd / docker-build-and-log-changeset.sh
Created May 8, 2020 22:49
Inspect file changes by every step in `docker build`
View docker-build-and-log-changeset.sh
#!/bin/bash
mkdir -p build.diffs;
i=0;
# put your docker build at enxt line. required `--no-cache --rm=false`
docker build --no-cache --rm=false -t docker101tutorial . |
grep -Pzo 'Step(.*)\n ---> Running .*\n' |
while read -r line && read -r line2;
do
@Gvozd
Gvozd / Notifications.gs
Last active April 30, 2023 09:03
Birthday Notifications in google calendar
View Notifications.gs
function createTrigger() {
ScriptApp.newTrigger('main')
.timeBased()
.everyDays(1)
.create();
}
function main() {
const {tmp, from, to} = getCalendars();
const syncedEvents = getEvents(to)
@Gvozd
Gvozd / main.js
Created July 4, 2018 09:37
Facebook, OAuth login. Correct opener in window
View main.js
mainWindow = new BrowserWindow({
webPreferences: {
nativeWindowOpen: true,// window.open return Window object(like in regular browsers), not BrowserWindowProxy
affinity: 'main-window'// main window, and addition windows should work in one process
}
});
mainWindow.webContents.on('new-window', function (e, url, frameName, disposition, options) {
// hook on new opened window
@Gvozd
Gvozd / sinon-stub-timings.js
Created February 26, 2017 15:39
Timings of call sinon-stubs
View sinon-stub-timings.js
let sinon = require('.');
class Foo {
bar() {
}
}
test('without stubing');
sinon.stub(Foo.prototype, 'bar').callsFake(function() {});
test('with stubing');