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
| parse_git_bullet () | |
| { | |
| if git rev-parse --git-dir >/dev/null 2>&1 | |
| then | |
| git_status="$(git status 2> /dev/null)" | |
| branch_pattern="^On branch ([^${IFS}]*)" | |
| if [[ ${git_status} =~ ${branch_pattern} ]]; then | |
| branch=${BASH_REMATCH[1]} | |
| echo "•" | |
| fi |
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
| // Probably best to have this within setup | |
| var ajaxStub = sinon.stub($, "ajax", function(event) { | |
| var result = $.Deferred(); | |
| result.args = event; | |
| return result; | |
| }); | |
| // Usage example | |
| var call = theAjaxCallToTest() | |
| // OR (if theAjaxCallToTest() doesn't return the actual ajax call) |
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
| // Use more robust placeholder support when specified | |
| // Because it wraps with a div, it can potentially break an inputs position, | |
| // so secondary placeholder support is provided as alternative | |
| $('.placeholder_support').each(function(i, el) { | |
| var $input = $(el), | |
| holderId = $input.attr('id') + "_placeholder", | |
| placeholder = $input.attr('placeholder'), | |
| lineHeight = $input.css('line-height'), | |
| paddingTop = parseInt($input.css('padding-top'), 10) | |
| + parseInt($input.css('border-top-width'), 10) + 'px', |
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
| # For better git prompts | |
| c_cyan=`tput setaf 6` | |
| c_red=`tput setaf 1` | |
| c_green=`tput sgr0 ; tput setaf 2` | |
| c_sgr0=`tput sgr0` | |
| branch_color () | |
| { | |
| if git rev-parse --git-dir >/dev/null 2>&1 | |
| then |
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
| Step 1 (add script to <head>): | |
| <head> | |
| <script>/Mobile|Android|BlackBerry/i.test(navigator.userAgent)&&(document.documentElement.className+=" mobile_browser");</script> | |
| </head> | |
| Step 2 (add css declaration): | |
| .link_to_show { |
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
| @mobileWeb = /Mobile|iP(hone|od|ad)|Android|BlackBerry|IEMobile|Kindle|NetFront|Silk-Accelerated|(hpw|web)OS|Fennec|Minimo|Opera M(obi|ini)|Blazer|Dolfin|Dolphin|Skyfire|Zune/i.test(navigator.userAgent) | |
| // Usage: if @mobileWeb then ... |
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 reducePaintOnScroll = (function() { | |
| var enableTimer = 0; | |
| window.addEventListener('scroll', function() { | |
| clearTimeout(enableTimer); | |
| removeHoverClass(); | |
| enableTimer = setTimeout(addHoverClass, 200); | |
| }, false); | |
| function removeHoverClass() { |
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
| input { | |
| border: solid 1px #bbb; | |
| padding: 5px; | |
| } | |
| input:focus::-webkit-input-placeholder { | |
| color: transparent; | |
| -webkit-transition: color 0.5s 0.5s ease; | |
| transition: color 0.5s 0.5s ease; | |
| } |
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
| # Easily delete branches remotely and locally | |
| # Simple type: | |
| # delete feature-branch-name | |
| function delete_branch() { | |
| log=$(git log origin/$1..$1 --oneline) | |
| if [[ -z "${log}" ]]; then | |
| git push origin :$1 | |
| git branch -D $1 | |
| elif [[ "${log}" == *"path not in the working tree"* ]]; then | |
| echo -e "\033[0;31mIt doesn't appear that your branch exists remotely." |
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
| monthLength = 31; | |
| if (monthNum==3 || monthNum==5 || monthNum==8 || monthNum==10) { | |
| monthLength = 30; | |
| } else if (monthNum==1) { | |
| if (year % 4 == 0 ) { | |
| if (year % 100 == 0) { | |
| if (year % 400 == 0) { | |
| monthLength = 29; | |
| } else { | |
| monthLength = 28; } |
NewerOlder