Skip to content

Instantly share code, notes, and snippets.

View GendelfLugansk's full-sized avatar

Gennady Dogaev GendelfLugansk

View GitHub Profile
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
@GendelfLugansk
GendelfLugansk / awaitable-timeout.js
Created February 26, 2019 23:44
Simple function to retry requests using request-promise module
export default function(t) {
return new Promise(resolve => {
setTimeout(resolve, t);
});
}
@GendelfLugansk
GendelfLugansk / README.md
Created July 22, 2019 12:26
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
GendelfLugansk / README.md
Created August 3, 2019 18:48
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
GendelfLugansk / controllers.application.js
Last active January 3, 2020 18:51
Question 59529650
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
GendelfLugansk / README.md
Last active April 28, 2024 06:11
Wrapper for expo-sqlite with async/await, migrations and transactions

Expo-sqlite - the right way

Why

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.

Documentation

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

@GendelfLugansk
GendelfLugansk / launcher.au3
Last active June 27, 2021 01:31
Origin 1.3.6 Launcher
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Compression=0
#AutoIt3Wrapper_Res_HiDpi=Y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <File.au3>
;Function for getting HWND from PID
Func _GetHwndFromPID($PID, $title)
$hwnd = 0