Skip to content

Instantly share code, notes, and snippets.

View restorer's full-sized avatar

Viachaslau Tratsiak restorer

View GitHub Profile
@restorer
restorer / chooser.js
Last active September 29, 2020 06:32
Phone chooser
'use strict';
// На текущий момент страница со списком устройств на сайте /e/ поменяла дизайн,
// так что проверка поддерживает ли устройство /e/ не работает. Но раньше работало :)
const fs = require('fs').promises;
const path = require('path');
const axios = require('axios');
const cheerio = require('cheerio');
const Iconv = require('iconv').Iconv;
@restorer
restorer / EspressoTestRule.java
Created September 2, 2018 12:14 — forked from patrickhammond/EspressoTestRule.java
Hacking through Espresso issues...
import android.app.Activity;
import android.app.Instrumentation;
import android.app.KeyguardManager;
import android.app.KeyguardManager.KeyguardLock;
import android.content.Context;
import android.content.pm.PackageManager;
import android.os.IBinder;
import android.os.PowerManager;
import android.os.PowerManager.WakeLock;
import android.support.test.InstrumentationRegistry;
@restorer
restorer / KeyValueIterator.hx
Created October 3, 2016 19:01 — forked from RealyUniqueName/KeyValueIterator.hx
Key-value map iterator
class KeyValueIterator<K,V> {
var map:Map<K,V>;
var keys:Iterator<K>;
static public inline function pairs<K,V>(map:Map<K,V>) return new KeyValueIterator(map);
public inline function new(map:Map<K,V>) {
this.map = map;
this.keys = map.keys();
}
@restorer
restorer / ColorActuator.hx
Created March 5, 2016 07:30
ColorActuator
package xxx.yyy.zzz;
#if (flash || nme || openfl)
import motion.Actuate;
import motion.actuators.IGenericActuator;
import motion.actuators.PropertyDetails;
import motion.actuators.SimpleActuator;
class ColorActuator<T> extends SimpleActuator<T, ColorActuator<T>> {
@restorer
restorer / cfor.hx
Created July 22, 2015 11:10
C-style for-loops for haxe
// http://yal.cc/haxe-some-cleaner-c-style-for-loops/
// macro
static macro function cfor(init, cond, post, expr) {
#if !display
var func = null;
func = function(expr:haxe.macro.Expr) {
return switch (expr.expr) {
package ;
class Test {
public function testShake(view:View):Tween {
return tweenManager.serial([
tweenManager.tween(view).toFloat({ offsetX: -5 }),
tweenManager.tween(view).toFloat({ offsetX: 5 }),
tweenManager.tween(view).toFloat({ offsetX: -5 }),
tweenManager.tween(view).toFloat({ offsetX: 5 }),
tweenManager.tween(view).toFloat({ offsetX: 0 }),
@restorer
restorer / js-hash-map
Created April 15, 2015 14:16
HashMap for javascript target
// http://kangax.github.io/compat-table/es5/#Object.create
var HashMap = function() {}
HashMap.prototype = Object.create(null);
var map = new HashMap();
map.__proto__ = '__proto__ value';
map.hasOwnProperty = 'hasOwnProperty value';
map.prototype = 'prototype value';
map.toString = 'toString value';