Skip to content

Instantly share code, notes, and snippets.


Gennady Dogaev GendelfLugansk

View GitHub Profile
GendelfLugansk / launcher.au3
Last active Jun 27, 2021
Origin 1.3.6 Launcher
View launcher.au3
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <File.au3>
;Function for getting HWND from PID
Func _GetHwndFromPID($PID, $title)
$hwnd = 0
GendelfLugansk /
Last active Oct 13, 2021
Wrapper for expo-sqlite with async/await, migrations and transactions

Expo-sqlite - the right way


With expo-sqlite it's not possible to execute few depending statements inside single transaction - db.transaction does not work with async/promise and tx.executeSql just enqueues sql statement but does not execute it.


Database class has two methods - execute (to execute single statement without transaction) and transaction(cb) to execute few statements inside a transaction

View controllers.application.js
import Ember from 'ember';
import EmberObject, { set } from '@ember/object';
import ArrayProxy from '@ember/array/proxy';
import { Promise, resolve, all } from 'rsvp';
const section = EmberObject.create();
const log = ArrayProxy.create({ content: [] });
export default Ember.Controller.extend({
appName: 'Question 59529650',
GendelfLugansk /
Created Aug 3, 2019
Dynamically change tawk locale

If you need to change tawk's locale dynamically (i.e. in SPA), here is the code I use. There is a small issue, though - everytime tawk adds new div to body and there is no way to correctly detect it and remove (ids are dynamic and there is no classname). However, as far as it is hidden, this should not be a problem.

GendelfLugansk /
Created Jul 22, 2019
JavaScript: decodeURIComponentWin1251

This method decodes string that was encoded by PHP's urlencode method using windows-1251 encoding (i.e. php -r "echo urlencode(iconv('utf8', 'windows-1251', 'Что-то с чем-то'));")

GendelfLugansk / awaitable-timeout.js
Created Feb 26, 2019
Simple function to retry requests using request-promise module
View awaitable-timeout.js
export default function(t) {
return new Promise(resolve => {
setTimeout(resolve, t);
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
View components.child-component.js
import Ember from 'ember';
export default Ember.Component.extend({
line1: "Say Hi!",
line2: "Say Yeah!",
changeAction(newAction) {
switch (newAction) {
case "1":
GendelfLugansk / gac.js
Last active Apr 28, 2018
Google analytics integration with user notice and consent (for static website which uses GA)
View gac.js
* Put this code in <head> tag. 'UA-XXXXX-Y' should be replaced with the property ID (also called the "tracking ID")
* of the Google Analytics property you wish to track. Also you may wish to change text and remove
* `ga('set', 'anonymizeIp', true);` line from `initGac` function. Style user notice with css.
* Please note that when user clicks "Disable cookies" this script removes google analytics' cookies and adds
* cookie with name `_gac_consent_`. It doesn't store any user data, just 'allow' or 'disable' string. This is
* needed to store user's answer. You may want to inform users about that in your Cookie Policy.
View components.person-component-2.js
import Ember from 'ember';
export default Ember.Component.extend({
classNames: ["person-card"]