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
  • 17:17 (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 / 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,
#
# Wide-open CORS config for nginx
#
location / {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
#
@vitalyrotari
vitalyrotari / notify.css
Last active December 19, 2015 04:58
JavaScript Notify Plugin
/**
* Reset
*/
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
html, body {
@vitalyrotari
vitalyrotari / characters.js
Created July 25, 2013 14:11
Angular Characters Filters
angular.module('app').filter('characters', function () {
return function(input, chars) {
if (isNaN(chars)) return input;
if (chars <= 0) return '';
if(input && input.length >= chars) {
input = input.substring(0, chars);
var lastspace = input.lastIndexOf(' ');
//get last space
if (lastspace !== -1) {
input = input.substr(0, lastspace);
@vitalyrotari
vitalyrotari / words.js
Created July 25, 2013 14:12
AngularJS Words Filter
angular.module('app').filter("words", function() {
return function(input, words) {
if (isNaN(words)) return input;
if (words<=0) return '';
if(input) {
var inputWords = input.split(/\s+/);
if (inputWords.length > words) {
input = inputWords.slice(0, words).join(' ') + '...';
}
}
@vitalyrotari
vitalyrotari / demo.md
Last active December 21, 2015 12:49
Canvas Pie Progress
@vitalyrotari
vitalyrotari / gist:6426228
Created September 3, 2013 16:31
AngularJS safe apply helper
/**
* @param {Scope} scope
* @param {Function} callback
*/
angular.safeApply = function (scope, callback) {
scope[(scope.$$phase || scope.$root.$$phase) ? '$eval' : '$apply'](callback || function() {});
};
/* Based on
* - EGM Mathematical Finance class by Enrique Garcia M. <egarcia@egm.co>
* - A Guide to the PMT, FV, IPMT and PPMT Functions by Kevin (aka MWVisa1)
*/
var ExcelFormulas = {
PVIF: function(rate, nper) {
return Math.pow(1 + rate, nper);
},
<!doctype html>
<html ng-app="Demo" ng-controller="AppController">
<head>
<meta charset="utf-8" />
<title>
Lazy Loading Images With AngularJS
</title>
<style type="text/css">