Skip to content

Instantly share code, notes, and snippets.

Avatar
Focusing

Nick Aliferov naliferov

Focusing
  • Kiev, Ukraine
View GitHub Profile
View gulp example.js
const { series, src, watch, dest, parallel } = require('gulp');
const concat = require('gulp-concat');
const cleanCSS = require('gulp-clean-css');
//const ts = require('gulp-typescript');
const gulpEsbuild = require('gulp-esbuild');
const buildCss = (cb) => {
src('src/frontend/css/**/*.css')
View tab.js
let tabs = {};
let activeTab = null;
class ConstructorTab {
activate() {
// let codeContainer = new DomElement('div');
// codeContainer.addClass('code_container');
//
// let codeLines = new DomElement('div');
@naliferov
naliferov / ProcessController.php
Created Jul 26, 2018
Simple process controller
View ProcessController.php
<?php
class ProcessController //Control php processes.
{
protected $pidDir;
public function __construct()
{
$this->pidDir = __DIR__ . '/pid';
if (!file_exists($this->pidDir)) {
@naliferov
naliferov / AMQPWorkerBase.php
Last active Jul 26, 2018
Amqp worker demo. Based on RabbitMQ.
View AMQPWorkerBase.php
<?php
abstract class AMQPWorkerBase
{
protected $connection;
protected $channel;
protected $exchange;
protected $queue;
protected $queueName;
@naliferov
naliferov / audio.js
Last active Jul 26, 2018
Web Audio API simple demo
View audio.js
AudioContext = window.AudioContext || window.webkitAudioContext;
let audio = new AudioContext();
let oscillator = audio.createOscillator();
oscillator.type = 'sawtooth';
oscillator.frequency.value = 30; //value in hertz
oscillator.start();
oscillator.connect(audio.destination);
@naliferov
naliferov / wiki.js
Last active Jul 26, 2018
Wikipedia parse list
View wiki.js
let items = [];
$('.wikitable').find('tr').each(function() {
let item = $(this).find('td').first().text().trim().toLowerCase();
items.push(item);
});
$('body').empty();
for (let i = 0; i < items.length; i++) {
@naliferov
naliferov / tree.js
Last active Jul 26, 2018
tree structure app
View tree.js
const TITLE_INDEX = 0;
const ADD_ITEM_BTN_INDEX = 1;
const ADD_SUBITEM_BTN_INDEX = 2;
const SUBITEMS_INDEX = 3;
function addClass(item, className) {
var itemClasses = item.className.split('');
for (var i = 0; i < itemClasses.length; i++) {
if (className === itemClasses[i]) {
return false;
View waterfall.js
//simple version without passing args
let asyncWaterfall = (array) => {
let execute = () => array.shift()(execute);
execute();
};
@naliferov
naliferov / more.js
Last active May 31, 2018
javascript archive
View more.js
x.getUrl = (url, callback) => {
fetch(url)
.then((response) => response.text())
.then((responseText) => {
callback(responseText);
});
};
x.cookie = {
set: function(key, value, expires_time) {