Skip to content

Instantly share code, notes, and snippets.

View vitalyrotari's full-sized avatar
🦥
I may be slow to respond.

Vitaly Rotari vitalyrotari

🦥
I may be slow to respond.
  • Everywhere
  • Chisiau, Moldova Republic of
  • 14:43 (UTC +03:00)
View GitHub Profile
@vitalyrotari
vitalyrotari / crawler.php
Created May 20, 2019 11:12 — forked from krakjoe/crawler.php
parallel Futures, Channels (buffered, unbuffered, synchros), Events using parallel producer/consumer pattern
<?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 09:49 — forked from jondot/keybez.md
ios keyboard bezier
  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 October 6, 2016 08:25 — forked from Jpoliachik/index.ios.js
ReactNative LayoutAnimation Example
'use strict';
import React, {
AppRegistry,
Component,
StyleSheet,
Text,
View,
TouchableOpacity,
LayoutAnimation,
} from 'react-native';
@vitalyrotari
vitalyrotari / socket-cheatsheet.js
Created August 27, 2016 19:15 — forked from alexpchin/socket-cheatsheet.js
A quick cheatsheet for socket.io
// 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 / esnextbin.md
Last active August 15, 2016 12:00
esnextbin sketch
@vitalyrotari
vitalyrotari / compile-scss.js
Created January 26, 2016 08:56
METEOR@1.3-modules-beta.4 SCSS fixes
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());
// 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:
/*
* Swipe 2.0
*
* Brad Birdsall
* Copyright 2012, Licensed GPL & MIT
*
*/
window.Swipe = function(element, options) {
@vitalyrotari
vitalyrotari / example.js
Created March 10, 2015 14:17
Ionic Framework change nav direction
$ionicViewSwitcher.nextDirection('forward ');
$state.go('app.home');
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
}