Skip to content

Instantly share code, notes, and snippets.

Avatar

Dmitri Ischenko ischenkodv

  • Ukraine, Kryvyi Rih
View GitHub Profile
View -
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 Mar 18, 2017
Example of writable stream in NodeJS.
View writable_stream.js
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 Jan 10, 2018 — forked from jasondavies/.block
Parallel Coordinates
View .block
license: gpl-3.0
View angular-controller-extend.js
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 Oct 28, 2015
Fibonacci function
View fibonacci.php
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');
}
}
View read_files_promises.js
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 Apr 18, 2015
Unit tests for lesson 2
View strings.js
/**
* 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) {
View GeolocationSpec.js
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 Feb 28, 2015
Jasmine plugin to test functions with requestAnimationFrame.
View RAFPlugin.js
/**
* 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 Feb 28, 2015
Unit tests for AsyncQueue
View AsyncQueueSpec.js
describe('run()', function() {
var realNextFrame, realCancelFrame;
beforeEach(function() {
jasmine.clock().install();
jasmine.RequestAnimationFrame.install();
realNextFrame = window.nextFrame;
realCancelFrame = window.cancelFrame;
window.nextFrame = window.requestAnimationFrame;
You can’t perform that action at this time.