This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Pipe, PipeTransform } from '@angular/core'; | |
@Pipe({ | |
name: 'fileSize' | |
}) | |
export class FileSizePipe implements PipeTransform { | |
private units = [ | |
'bytes', | |
'KB', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
language: node_js | |
sudo: required | |
dist: trusty | |
node_js: | |
- '6.9' | |
addons: | |
apt: | |
sources: | |
- google-chrome |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$( document ).ready(function() { | |
if ( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) { | |
var h = $('.height-fix').height(); | |
$('.height-fix').height(h); | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$checkout_box.one('webkitAnimationEnd oanimationend msAnimationEnd animationend', | |
function (e) { | |
$checkout_box.removeClass('tada'); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function remove(array, element) { | |
return array.filter(e => e !== element); | |
} | |
const vowelsAndX = ["a", "e", "i", "o", "u", "x"]; | |
const vowels = remove(vowelsAndX, "x"); | |
vowels.toString(); // "a,e,i,o,u" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//http://stackoverflow.com/questions/5527601/normalizing-mousewheel-speed-across-browsers | |
var wheelDistance = function(evt){ | |
if (!evt) evt = event; | |
var w=evt.wheelDelta, d=evt.detail; | |
if (d){ | |
if (w) return w/d/40*d>0?1:-1; // Opera | |
else return -d/3; // Firefox; TODO: do not /3 for OS X | |
} else return w/120; // IE/Safari/Chrome TODO: /3 for Chrome OS X | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var $string = $string.charAt(0).toUpperCase() + $string.slice(1); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('#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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, |