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
/** | |
* Get parent node for given tagname | |
* @param {Object} node DOM node | |
* @param {String} tagname HTML tagName | |
* @return {Object} Parent node | |
*/ | |
function getParentByTagName(node, tagname) { | |
var parent; | |
if (node === null || tagname === '') return; | |
parent = node.parentNode; |
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
/* | |
Element to slide gets the following CSS: | |
max-height: 0; | |
opacity: 0; | |
overflow: hidden; | |
transition: max-height 0.4s ease 0s; | |
*/ | |
/** | |
* Like jQuery's slideDown function - uses CSS3 transitions |
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
/*! A fix for the iOS orientationchange zoom bug. | |
Script by @scottjehl, rebound by @wilto. | |
MIT / GPLv2 License. | |
Source: https://github.com/scottjehl/iOS-Orientationchange-Fix | |
Explanation: http://adactio.com/journal/4470/ | |
*/ | |
// No code, check source above | |
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
/** | |
* Check element has a certain classname | |
* We cannot use classList yet because of browser support | |
* @param {Object} ele DOM element | |
* @param {String} cls Classname | |
* @return {Boolean} True is classname is found | |
*/ | |
function hasClass(ele,cls) { | |
if (ele === null || cls === '') return false; | |
return ele.className.match(new RegExp('(\\s|^)'+cls+'(\\s|$)')); |
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
/* | |
Returns true if element has next sibling (of type element) | |
*/ | |
function hasNextSibling(node) { | |
var bln = false; | |
while( (node = node.nextSibling) !== null ) { | |
if (node.nodeType !== 1) { | |
continue; | |
} | |
bln = true; |
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
echo "Start Git pre commit hook" | |
#!/bin/sh | |
# stash unstaged changes, run release task, stage release updates and restore stashed files | |
NAME=$(git branch | grep '*' | sed 's/* //') | |
# don't run on rebase | |
if [ $NAME != '(no branch)' ] | |
then |
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
# -r -> Include subdirectories | |
# -n -> Print line number | |
# -i -> Ignore case | |
# . -> From current directory | |
grep -rn "searchString" . |
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
grunt.registerTask('default', function () { | |
var fs = require('fs'); | |
// my precommit hook is inside the repo as /hooks/pre-commit | |
// copy the hook file to the correct place in the .git directory | |
grunt.file.copy('hooks/pre-commit', '.git/hooks/pre-commit'); | |
// chmod the file to readable and executable by all | |
fs.chmodSync('.git/hooks/pre-commit', '755'); | |
}); |
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
#!/bin/sh | |
# | |
npm version patch | |
git add package.json | |
exit 0 |
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
# Add to .bashrc | |
alias ios='open /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app' |
OlderNewer