Skip to content

Instantly share code, notes, and snippets.

View hyzhak's full-sized avatar
🤔
feel creative

Ievgenii Krevenets hyzhak

🤔
feel creative
View GitHub Profile
@hyzhak
hyzhak / gist:ac6cae5aae10f78aa685
Created May 5, 2014 11:36
How to fail jasmine 2.0 async spec on fail promise (ru)
it('should ....', function(done) {
doAsync().then(function() {
done();
}, function(err) {
//как правильно писать чтобы тест падал в любом случае?
//done(err || 'error') - не работает, т.к. done не обробатывает аргументы;
});
});
@hyzhak
hyzhak / gist:71e9ee218c017f9ce4ef
Created May 5, 2014 11:37
How to fail jasmine 2.0 async spec on fail promise
it('should ....', function(done) {
doAsync().then(function() {
done();
}, function(err) {
//How to fail jasmine 2.0 async spec on fail promise
//done(err || 'error') - doesn't work because 'done' doesn't handle arguments
});
});
@hyzhak
hyzhak / setupLogger.js
Created June 11, 2014 08:17
how to setup Winston logger by nconf
/**
* Setup multiple winston logger:
* https://github.com/flatiron/winston#working-with-multiple-loggers-in-winston
*
* by nconf:
* https://github.com/flatiron/nconf
*/
var winston = require('winston'),
nconf = require('nconf');
@hyzhak
hyzhak / Dockerfile
Created October 25, 2014 11:58
Hello World Test Docker. Try to echo "Hello World!!" to console
# Use phusion/baseimage as base image. To make your builds
# reproducible, make sure you lock down to a specific version, not
# to `latest`! See
# https://github.com/phusion/baseimage-docker/blob/master/Changelog.md
# for a list of version numbers.
FROM phusion/baseimage:0.9.15
MAINTAINER hyzhaka@gmail.com
# Set correct environment variables.
ENV HOME /root
@hyzhak
hyzhak / gist:fb6175e6a0072128b0c1
Last active August 29, 2015 14:08
i18n of MongoDB (Mongoose) - normalization vs de-normalization
// de-normalized
{
"_id": <ObjectId1>,
"name": {
"en": "Eugene",
"uk": "Євген"
}
}
//or normalized
receipt: Oz-Ware Purchase Invoice
date: 2012-08-06
customer:
given: Dorothy
family: Gale
#!/bin/bash
livestreamer --stream-segment-timeout 100000 --stream-timeout 100000 --http-timeout 100000 ustream.tv/channel/iss-hdev-payload best -np 'omxplayer -o hdmi -live --timeout 100000'
private var rc:Number = 1/3, gc:Number = 1/3, bc:Number = 1/3;
private var sf:ColorMatrixFilter = new ColorMatrixFilter([rc, gc, bc, 0, 0, rc, gc, bc, 0, 0, rc, gc, bc, 0, 0, 0, 0, 0, 1, 0]);
private function blackAndWhite(target:UIComponent, enabled:Boolean):void
{
if(enabled) target.filters = [sf];
else target.filters = [];
}
@hyzhak
hyzhak / modules
Created September 7, 2015 00:27
$ sudo nano /etc/modules #setup touchscreen for RPI2
#original
fbtft_device name=waveshare32b gpios=dc:22,reset:27 speed=48000000
waveshare32b width=320 height=240 buswidth=8 init=-1,0xCB,0x39,0x2C,0x00,0x34,0x02,-1,0xCF,0x00,0XC1,0X30,-1,0xE8,0x85,0x00,0x78,-1,0xEA,0x00,0x00,-1,0xED,0x64,0x03,0X12,0X81,-1,0xF7,0x20,-1,0xC0,0x23,-1,0xC1,0x10,-1,0xC5,0x3e,0x28,-1,0xC7,0x86,-1,0x36,0x28,-1,0x3A,0x55,-1,0xB1,0x00,0x18,-1,0xB6,0x08,0x82,0x27,-1,0xF2,0x00,-1,0x26,0x01,-1,0xE0,0x0F,0x31,0x2B,0x0C,0x0E,0x08,0x4E,0xF1,0x37,0x07,0x10,0x03,0x0E,0x09,0x00,-1,0XE1,0x00,0x0E,0x14,0x03,0x11,0x07,0x31,0xC1,0x48,0x08,0x0F,0x0C,0x31,0x36,0x0F,-1,0x11,-2,120,-1,0x29,-1,0x2c,-3
#my version
fbtft_device debug=3 rotate=90 name=flexfb speed=30000000 gpios=reset:25,dc:24
flexfb width=320 height=480 regwidth=16 init=-1,0xb0,0x0,-1,0x11,-2,250,-1,0x3A,0x55,-1,0xC2,0x44,-1,0xC5,0x00,0x00,0x00,0x00,-1,0xE0,0x0F,0x1F,0x1C,0x0C,0x0F,0x08,0x48,0x98,0x37,0x0A,0x13,0x04,0x11,0x0D,0x00,-1,0xE1,0x0F,0x32,0x2E,0x0B,0x0D,0x05,0x47,0x75,0x37,0x06,0x10,0x03,0x24,0x20,0x00,-1,0xE2,0x0F,0x32,0x2E
@hyzhak
hyzhak / cmdline.txt
Created September 7, 2015 00:29
$sudo nano /boot/cmdline.txt #setup touchscreen for Raspberry 2
# original
dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait fbtft_device.custom fbtft_device.name=waveshare32b fbtft_device.gpios=dc:22,reset:27 fbtft_device.bgr=1 fbtft_device.speed=48000000 fbcon=map:10 fbcon=font:ProFont6x11 logo.nologo dma.dmachans=0x7f35 console=tty1 consoleblank=0 fbtft_device.fps=50 fbtft_device.rotate=0
# my version
dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait fbcon=map:1 fbcon=font:ProFont6x11