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
  • 03:45 (UTC +03:00)
View GitHub Profile
@vitalyrotari
vitalyrotari / gestures.js
Last active April 21, 2023 16:35
Vanilla JS Touch Gestures | Original Size: 6.71KB (2.08KB gzipped) | Compiled Size: 2.69KB (1.2KB gzipped)
/*
* Vanilla JS - Touch Gestures
* @version 0.1
* @inspired QuoJS - http://quojs.tapquo.com
*
* Supported Gestures: singleTap, doubleTap, hold,
* swipe, swiping, swipeLeft, swipeRight, swipeUp, swipeDown,
* rotate, rotating, rotateLeft, rotateRight, pinch, pinching,
* pinchIn, pinchOut,
* drag, dragLeft, dragRight, dragUp, dragDown
@vitalyrotari
vitalyrotari / touch.js
Last active October 22, 2021 22:01
jQuery Touch Gestures
jQuery Touch Gestures ported from QUOjs
@see http://quojs.tapquo.com/
Version 1.1
-- @add singleTap event
-- @fix doubleTap event
-- @fix hold event
@vitalyrotari
vitalyrotari / device.js
Created August 2, 2012 12:41
Detect Mobile Devices
var Device = {
ENV_DESKTOP: 'desktop',
ENV_PHONE: 'phone',
ENV_TABLET: 'tablet',
ENV_PORTRAIT: 'portrait',
ENV_LANDSCAPE: 'landscape',
agent: {
mobile: (/iphone|ipod|android|blackberry|opera|mini|windows\sce|palm|smartphone|iemobile/i.test(window.navigator.userAgent.toLowerCase())),
tablet: (/ipad|android|android\s3\.0|xoom|sch-i800|playbook|tablet|kindle/i.test(window.navigator.userAgent.toLowerCase()))
},
@vitalyrotari
vitalyrotari / fx.js
Last active February 22, 2021 19:06
Vanilla JS - Fx | CSS Transition animation
(function (window, Element, undefined) {
'use strict';
var prefix = '',
eventPrefix,
vendors = { Webkit: 'webkit', Moz: '', O: 'o', ms: 'MS' },
document = window.document,
testEl = document.createElement('div'),
supportedTransforms = /^((translate|rotate|scale)(X|Y|Z|3d)?|matrix(3d)?|perspective|skew(X|Y)?)$/i,
transform,
@vitalyrotari
vitalyrotari / nexus7.css
Created November 9, 2012 12:30
Nexus 7 - CSS Media Query
@media only screen and (min-device-width: 800px) and (orientation: portrait) {
#device:after {
content: "Nexus 7 - portrait - firefox";
}
}
@media screen and (min-device-width : 602px) and (orientation: portrait) {
#device:after {
content: "Nexus 7 - portrait - chrome";
}
}
@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 / bootstrap.php
Created February 16, 2012 11:30
Language support for FuelPHP
/**
* app/bootstrap.php
*/
Autoloader::add_classes(array(
// Add classes you want to override here
// Example: 'View' => APPPATH.'classes/view.php',
'Uri' => APPPATH.'classes/uri.php',
'LayoutHelper' => APPPATH.'classes/layouthelper.php',
));
@vitalyrotari
vitalyrotari / jquery.eraser.js
Last active December 22, 2017 16:01
jQuery Eraser Plugin
/*
* Forked from: https://github.com/boblemarin/jQuery.eraser
*/
(function( $ ){
var $win = $(window);
var Eraser = function(element, options) {
this.$element = $(element);
this.options = options;
@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 / 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