This file contains 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 os | |
import sys | |
import subprocess | |
class FileHeadRule: | |
def __init__(self): | |
self.once = False | |
def condition(self,line): |
This file contains 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
.box{ | |
width: 100px; | |
height: 100px; | |
float: left; | |
margin: 10px; | |
border: 1px solid black; | |
} | |
/* Only one item */ |
This file contains 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 latestKnownScrollY = 0, | |
ticking = false; | |
function onScroll(){ | |
latestKnownScrollY = window.scrollY; | |
requestTick(); | |
} |
This file contains 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 whichAnimationEndEvent(){ | |
var el = document.createElement('fakeelement'); | |
var animationsEvents = { | |
'WebkitAnimation' : 'webkitAnimationEnd', | |
'OAnimation' : 'oAnimationEnd', | |
'msAnimation' : 'MSAnimationEnd', | |
'animation' : 'animationend' | |
}; | |
for(var t in animationsEvents){ |
This file contains 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 attach = require('attach.js'); | |
var utils = require('./helpers/utils'); | |
var constants = require('./helpers/const'); | |
/** | |
* Create a new accordion object | |
* @param {HTMLElement} el | |
*/ | |
function Accordion(el) { |
This file contains 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 docElem = window.document.documentElement; | |
function getViewportH() { | |
var client = docElem['clientHeight'], | |
inner = window['innerHeight']; | |
if( client < inner ) | |
return inner; | |
else | |
return client; |
This file contains 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
<div class="fullscreen" data-img-width="1500" data-img-height="900"> <---- because its a background image, we need the width and height | |
// whatever here. If it was a normal image tag, we could just get it off | |
</div> the image | |
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
.fullscreen { | |
width: 100%; | |
height: 100%; | |
background-image:url('http://someimage.jpg'); |
This file contains 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 timeoutfunc(fn,delay) { | |
var intv = setTimeout(function() { | |
intv = null; | |
fn(new Error("Timeout")); | |
}, delay); | |
return function() { | |
// timeout hasn't happened yet? | |
if(intv) { | |
clearTimeout(intv); |
This file contains 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
/** | |
* Timeout promise that can cancel a long running promise | |
* using Promise.race | |
*/ | |
function timeoutPromise(delay) { | |
return new Promise(function(resolve, reject) { | |
setTimeout(function(){ | |
reject("Timeout!"); | |
}, delay); |
OlderNewer