Skip to content

Instantly share code, notes, and snippets.

View ischenkodv's full-sized avatar

Dmitri Ischenko ischenkodv

  • Ukraine, Kryvyi Rih
View GitHub Profile
@ischenkodv
ischenkodv / -
Created February 7, 2018 13:39 — forked from anonymous/-
System: Host: dima-System-Product-Name Kernel: 4.10.0-42-generic x86_64 (64 bit gcc: 5.4.0)
Desktop: Cinnamon 3.4.4 (Gtk 2.24.30) dm: mdm Distro: Linux Mint 18.2 Sonya
Machine: Mobo: ASUSTeK model: M4A785T-M v: Rev X.0x Bios: American Megatrends v: 0801 date: 10/14/2009
CPU: Dual core AMD Phenom II X2 550 (-MCP-) cache: 1024 KB
flags: (lm nx sse sse2 sse3 sse4a svm) bmips: 12455
clock speeds: min/max: 800/3100 MHz 1: 1900 MHz 2: 1900 MHz
Graphics: Card: Advanced Micro Devices [AMD/ATI] Redwood XT [Radeon HD 5670/5690/5730]
bus-ID: 01:00.0 chip-ID: 1002:68d8
Display Server: X.Org 1.18.4 drivers: ati,radeon (unloaded: fbdev,vesa)
Resolution: 1920x1080@60.00hz
@ischenkodv
ischenkodv / writable_stream.js
Created March 18, 2017 21:54
Example of writable stream in NodeJS.
const stream = require('stream');
const fs = require('fs');
class EchoStream extends stream.Writable {
_write(chunk, enc, next) {
console.log(chunk.toString());
next();
}
}
@ischenkodv
ischenkodv / .block
Last active January 10, 2018 17:27 — forked from jasondavies/.block
Parallel Coordinates
license: gpl-3.0
module.controller('CtrlImplAdvanced', ['$scope', '$controller', function ($scope, $controller) {
// Initialize the super class and extend it.
angular.extend(this, $controller('CtrlImpl', {$scope: $scope}));
// … Additional extensions to create a mixin.
}]);
@ischenkodv
ischenkodv / fibonacci.php
Created October 28, 2015 08:54
Fibonacci function
function fibonacci($n) {
if (is_int($n)) {
return round(pow((sqrt(5)+1)/2, $n) / sqrt(5));
} else {
throw new Exception('Value should be an integer');
}
}
var fs = require('fs');
var files = ['foo.txt', 'bar.txt', 'baz.txt'];
var promises = [];
for (var i = 0; i < files.length; i++) {
promises.push(readFile(files[i]));
}
@ischenkodv
ischenkodv / strings.js
Created April 18, 2015 21:07
Unit tests for lesson 2
/**
* This is module to test.
*/
module.exports = {
camelCase: function(string) {
return string.replace(/-[a-z]/g, function(match) {
return match[1].toUpperCase() + match.slice(2);
});
},
dashSeparated: function(string) {
describe('findByNavigator()', function() {
var geolocator, fnDone, fnFail;
beforeEach(function() {
geolocator = new Geolocator({language: 'fi'});
});
it('can find user location', function() {
var location, address, components;
@ischenkodv
ischenkodv / RAFPlugin.js
Created February 28, 2015 20:24
Jasmine plugin to test functions with requestAnimationFrame.
/**
* Jasmine RequestAnimationFrame: a set of helpers for testing funcionality
* that uses requestAnimationFrame under the Jasmine BDD framework for JavaScript.
*/
;(function() {
var index = 0,
callbacks = {};
function MockRAF(global) {
@ischenkodv
ischenkodv / AsyncQueueSpec.js
Created February 28, 2015 20:22
Unit tests for AsyncQueue
describe('run()', function() {
var realNextFrame, realCancelFrame;
beforeEach(function() {
jasmine.clock().install();
jasmine.RequestAnimationFrame.install();
realNextFrame = window.nextFrame;
realCancelFrame = window.cancelFrame;
window.nextFrame = window.requestAnimationFrame;