Skip to content

Instantly share code, notes, and snippets.

Dmitry Semenov dimsemenov

Block or report user

Report or block dimsemenov

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@dimsemenov
dimsemenov / ba.css
Created Oct 27, 2017
Before/After image viewer, will probably create a separate repo for it some day... (c)
View ba.css
img {
margin: 0;
padding: 0;
display: block;
}
.ba-viewer {
overflow: hidden;
position: relative;
width: 100%;
@dimsemenov
dimsemenov / count-words.js
Created Oct 21, 2016
Counts words & sorts them by number of occurences
View count-words.js
var fileToTest = grunt.file.read('somefile.js');
var vars = fileToTest.match(/(\w+)/g);
var i = vars.length;
var count;
var parsedVars = [];
var maxWordLen = 3;
while(i--) {
var word = vars[i];
View mini-masonry-grid.js
(function(window) {
'use strict';
var toggleEvent = function(el, name, fn, unbind) {
var methodName = (unbind ? 'remove' : 'add') + 'EventListener';
el[methodName](name, fn, false);
};
View gist:2068c00fcb6eb9c05529
Verifying that +dimsemenov is my blockchain ID. https://onename.com/dimsemenov
View fire_royalslider.php
function fire_royalslider_func($atts){
$sliderid = $atts['id'];
$out = '';
if (!$sliderid) return;
/* Print slider HTML, skip this part if you already have it on page */
$out .= get_new_royalslider($sliderid);
/* Print slider END */
// Init code
View deeplinking.js
(function($) {
"use strict";
$.extend($.rsProto, {
_initDeeplinking: function() {
var self = this,
isBlocked,
hashTimeout,
hashChangeTimeout;
View desktop-zoom.js
/**
*
* desktop-zoom.js:
*
* - Binds mousewheel event for paning zoomed image.
* - Manages "dragging", "zoomed-in", "zoom-out" classes.
* (which are used for cursors and zoom icon)
* - Adds toggleDesktopZoom function.
*
*/
View core.js
//function(template, UiClass, items, options)
var self = this;
/**
* Static vars, don't change unless you know what you're doing.
*/
var DOUBLE_TAP_RADIUS = 25,
NUM_HOLDERS = 3;
View gist:0ad2ef805170e7ff4540
(function() {
var homepage = 'example.com',
url = window.location.href.toLowerCase();
if(url.indexOf(homepage) === -1) {
return;
}
// tracking code...
@dimsemenov
dimsemenov / track-js-error.js
Created Dec 28, 2014
Track JavaScript errors with Google Analytics (as events)
View track-js-error.js
(function() {
function trackJavaScriptError(e) {
e = e || window.event;
if(!e || !e.message || !e.lineno){
return true;
}
var errMsg = e.message;
var errSrc = e.filename + ': ' + e.lineno;
ga('send', 'event', 'JavaScript Error', errMsg, errSrc, { 'nonInteraction': 1 });
}
You can’t perform that action at this time.