Skip to content

Instantly share code, notes, and snippets.

Avatar
🦥
I may be slow to respond.

Vitaly Rotari vitalyrotari

🦥
I may be slow to respond.
  • Terranet
  • Chisiau, Moldova Republic of
View GitHub Profile
@vitalyrotari
vitalyrotari / crawler.php
Created May 20, 2019 — forked from krakjoe/crawler.php
parallel Futures, Channels (buffered, unbuffered, synchros), Events using parallel producer/consumer pattern
View crawler.php
<?php
use \parallel\{Runtime, Future, Channel, Events};
/* usage php crawler.php [http://example.com] [workers=8] [limit=500] */
$page = $argv[1] ?: "https://blog.krakjoe.ninja"; # start crawling this page
$workers = $argv[2] ?: 8; # start this number of threads
$limit = $argv[3] ?: 500; # stop at this number of unique pages
$timeout = $argv[4] ?: 3; # socket timeout for producers
@vitalyrotari
vitalyrotari / keybez.md
Created May 19, 2017 — forked from jondot/keybez.md
ios keyboard bezier
View keybez.md
  onKeyboardWillHide(e) {
    Animated.timing(this.state.height, {
      toValue: this.listViewMaxHeight,
      duration: e.duration,
      easing: Easing.bezier(0.1, 0.76, 0.55, 0.9)
    }).start();
  },

  onKeyboardWillShow(e) {
@vitalyrotari
vitalyrotari / index.ios.js
Created Oct 6, 2016 — forked from Jpoliachik/index.ios.js
ReactNative LayoutAnimation Example
View index.ios.js
'use strict';
import React, {
AppRegistry,
Component,
StyleSheet,
Text,
View,
TouchableOpacity,
LayoutAnimation,
} from 'react-native';
@vitalyrotari
vitalyrotari / socket-cheatsheet.js
Created Aug 27, 2016 — forked from alexpchin/socket-cheatsheet.js
A quick cheatsheet for socket.io
View socket-cheatsheet.js
// sending to sender-client only
socket.emit('message', "this is a test");
// sending to all clients, include sender
io.emit('message', "this is a test");
// sending to all clients except sender
socket.broadcast.emit('message', "this is a test");
// sending to all clients in 'game' room(channel) except sender
@vitalyrotari
vitalyrotari / compile-scss.js
Created Jan 26, 2016
METEOR@1.3-modules-beta.4 SCSS fixes
View compile-scss.js
const path = Plugin.path;
const fs = Plugin.fs;
const sass = Npm.require('node-sass');
const Future = Npm.require('fibers/future');
const files = Plugin.files;
Plugin.registerCompiler({
extensions: ['scss', 'sass'],
archMatching: 'web'
}, () => new SassCompiler());
View hyphens.scss
// Provides a mixin to define hyphenation
//
// Requires Compass
//
// (http://blog.fontdeck.com/post/9037028497/hyphens)
// (http://www.w3.org/TR/css3-text/#hyphenation)
//
// $value - The hyphenation property value. One of "none", "manual", "auto" or "all"
//
// Example .scss:
View SwipeIE10.js
/*
* Swipe 2.0
*
* Brad Birdsall
* Copyright 2012, Licensed GPL & MIT
*
*/
window.Swipe = function(element, options) {
@vitalyrotari
vitalyrotari / example.js
Created Mar 10, 2015
Ionic Framework change nav direction
View example.js
$ionicViewSwitcher.nextDirection('forward ');
$state.go('app.home');
View slugify.js
function slugify(text)
{
return text.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
.replace(/\-\-+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
.replace(/-+$/, ''); // Trim - from end of text
}