Skip to content

Instantly share code, notes, and snippets.

@shabanovtg
shabanovtg / web-servers.md
Created December 24, 2020 09:37 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@shabanovtg
shabanovtg / redis_migrate.py
Created July 27, 2018 15:05 — forked from josegonzalez/redis_migrate.py
A simple script to migrate all keys from one Redis to another
#!/usr/bin/env python
import argparse
import redis
def connect_redis(conn_dict):
conn = redis.StrictRedis(host=conn_dict['host'],
port=conn_dict['port'],
db=conn_dict['db'])
return conn
@shabanovtg
shabanovtg / localStorageSupport.js
Created July 11, 2016 14:10
localStorageSupport
'use strict';
function supportsHtml5Storage() {
try {
//jscs:disable
return 'localStorage' in window && window['localStorage'] !== null; // jshint ignore:line
//jscs:enable
} catch (e) {
return false;
}
t = {
initTooltip: function() {
var $tooltipsCircles = $('.js-tooltip-circles');
$tooltipsCircles.tooltip({
show: 'fold',
position: {
my: 'center bottom-20',
at: 'center top',
using: function(position, feedback) {
@shabanovtg
shabanovtg / back-to-top.js
Last active August 2, 2016 12:55
back-to-top block
'use strict';
(function ($) {
var $body,
$window,
backToTop = {
init: function () {
this.$backToTop = $('#back-top');
this.$header = $('#header');
this.$footer = $('#footer');
@shabanovtg
shabanovtg / _js-capabilities
Created March 4, 2016 07:25
js-capabilities
We couldn’t find that file to show.
@shabanovtg
shabanovtg / css-media-resolutions.less
Created February 25, 2016 08:00
css-media-resolutions.less
/* wday-banner start */
.wday-banner {
&__i {
&:extend(.clearfix all);
margin-top: -5.9rem;
background-image: url(../../img/wday/bg-banner.png);
background-repeat: no-repeat;
background-position: top center;
background-size: cover;
@shabanovtg
shabanovtg / swipe.simple.js
Created December 16, 2015 06:48
swipe.simple.js
/**
* Swipe
*/
document.addEventListener('touchstart', handleTouchStart, false);
document.addEventListener('touchmove', handleTouchMove, false);
var xDown = null;
var yDown = null;
function handleTouchStart(ev) {
@shabanovtg
shabanovtg / dont-scroll-parent.js
Last active November 24, 2015 08:25
dont-scroll-parent.js jQuery plugin not ideal
;(function ($) {
'use strict';
$.fn.dontScrollParent = function(options) {
options = $.extend({
// defaults
wheelstop: null // Function
}, options);
// Compatibilities
var $userBasketDropdown = jQuery('.user-basket .dropdown'),
$userBasketContent = jQuery('.user-basket .dropdown-menu');
$userBasketDropdown.addClass('open');
function mouseWheelMiniCartHandler(ev) {
var height = $userBasketContent.height(),
scrollHeight = $userBasketContent.get(0).scrollHeight,
st = $userBasketContent.scrollTop(),
wheelDelta = ev.originalEvent.wheelDelta;