Skip to content

Instantly share code, notes, and snippets.

@Solomko2
Solomko2 / README.md
Created October 6, 2015 20:27 — forked from theRemix/README.md
The Holy Grail - Gulp + Sass + LiveReload + Foundation

Gulp + Sass + LiveReload + Foundation

Goals

To have a gulp workflow that with a single process,

  1. watches for any sass changes, then compiles sass source into css
  2. watches for any changes in the public directory, triggers live-reload
  3. serves your static content in public/
$(document).ready(function() {
// Загрузка из localStorage сохранённого пункта меню и открытие его
var storage = localStorage.getItem('item');
if (storage && storage !== "#") {
$('.nav-tabs a[href="' + storage + '"]').tab('show');
}
// Функция клика на произвольный пункт меню
$('ul.nav').on('click', 'li:not(.active, .dropdown, .disabled, .divider)', function() {
@Solomko2
Solomko2 / sm-annotated.html
Created October 23, 2015 22:01 — forked from hdragomir/sm-annotated.html
The deferred font loading logic for Smashing Magazine. http://www.smashingmagazine.com/
<script type="text/javascript">
(function () {
"use strict";
// once cached, the css file is stored on the client forever unless
// the URL below is changed. Any change will invalidate the cache
var css_href = './index_files/web-fonts.css';
// a simple event handler wrapper
function on(el, ev, callback) {
if (el.addEventListener) {
el.addEventListener(ev, callback, false);
@Solomko2
Solomko2 / gulpfile.js
Created November 27, 2015 23:38 — forked from korinVR/gulpfile.js
Babel + Gulp + Watchify + BrowserSync
var gulp = require("gulp");
var gutil = require("gulp-util");
var notify = require('gulp-notify');
var source = require("vinyl-source-stream");
var buffer = require('vinyl-buffer');
var browserify = require("browserify");
var watchify = require("watchify");
var babelify = require("babelify");
var browserSync = require("browser-sync").create();
@Solomko2
Solomko2 / gulpfile.js
Last active November 28, 2015 21:13
babel
var gulp = require("gulp");
var browserify = require("browserify");
var source = require("vinyl-source-stream");
gulp.task("es6", function() {
return browserify("./src/app.js")
.transform("babelify")
.bundle()
.pipe(source("bundle.js"))
.pipe(gulp.dest("dist"));
@Solomko2
Solomko2 / gulpfile.js
Created May 15, 2016 19:34 — forked from kacpak/gulpfile.js
Angular2 compilation
'use strict';
var gulp = require('gulp');
var sass = require('gulp-sass');
var ts = require('gulp-typescript');
var tsProject = ts.createProject('tsconfig.json', {typescript: require('typescript')});
var paths = {
sass: ['./resources/sass/**/*.scss'],
ts: ['./resources/app/**/*.ts'],
@Solomko2
Solomko2 / clear hash.js
Last active July 29, 2016 10:38
Очистить HASH
Best is Homero Barbosa's answer below:
history.pushState("", document.title, window.location.pathname);
... or, if you want to maintain the search parameters:
history.pushState("", document.title, window.location.pathname + window.location.search);
EDITED, old, do not use, badwrongfun:
var loc = window.location.href,
@Solomko2
Solomko2 / select to list.js
Last active July 29, 2016 10:37
Звменить select обычным списком
$('#yearfilter').parent().append('<ul id="newyearfilter" name="yearfilter"></ul>');
$('#yearfilter option').each(function(){
$('#newyearfilter').append('<li value="' + $(this).val() + '">'+$(this).text()+'</li>');
});
$('#yearfilter').remove();
$('#newyearfilter').attr('id', 'yearfilter');
function constructselect(id, name, newId, newName) {
var $id = $('#' + id);
var $string = $string.charAt(0).toUpperCase() + $string.slice(1);
@Solomko2
Solomko2 / swipeEvents.js
Created August 4, 2016 09:03 — forked from Tivoli/ swipeEvents.js
Javascript Swipe Events
function getSwipeEvent(deltaX, deltaY) {
switch(true) {
case deltaX >= 50: return new Event('swipeLeft');
case deltaX <= -50: return new Event('swipeRight');
case deltaY >= 50: return new Event('swipeUp');
case deltaY <= -50: return new Event('swipeDown');
}
}
function swipeEvents() {