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
| $ git checkout -b serverfix origin/serverfix | |
| Branch serverfix set up to track remote branch serverfix from origin. | |
| Switched to a new branch 'serverfix' | |
| How to see git log of someone who commit during date range | |
| For example: I want to see all commits from "daihuaye" on 2/25/2015 | |
| $ git log --after="2015-2-25 00:00" --before="2015-2-25 23:59" --author="daihuaye" | |
| Set ruby gem to current ruby version (guidevine) fix issue of bundle install | |
| $ rvm rvmrc to ruby-version |
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
| // https://github.com/twbs/bootstrap/blob/master/js/carousel.js line 149 | |
| $next[0].offsetWidth // force reflow |
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
| /* ======================================================================== | |
| * Bootstrap: carousel.js v3.0.0 | |
| * http://twbs.github.com/bootstrap/javascript.html#carousel | |
| * ======================================================================== | |
| * Copyright 2012 Twitter, Inc. | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * |
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
| if (!window.location.origin) { | |
| window.location.origin = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port: ''); | |
| } |
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 myElement = document.getElementById('myElement'), // contains attribute data-my-custom-value | |
| myCustomValue; | |
| if(myElement.dataset !== undefined) { // standard approach | |
| myCustomValue = myElement.dataset.myCustomValue; | |
| } else { | |
| myCustomValue = myElement.getAttribute('data-my-custom-value'); // IE approach | |
| myElement.setAttribute('data-my-custom-value', 'new value') // set new value on the data attribute | |
| } |
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 generateUid = function() { | |
| var d = new Date().getTime(); | |
| var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { | |
| var r = (d + Math.random()*16)%16 | 0; | |
| d = Math.floor(d/16); | |
| return (c === 'x' ? r : (r&0x7|0x8)).toString(16); | |
| }); | |
| return uuid; | |
| }; |
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
| formattedPhoneNumber: function formattedPhoneNumber(phone) { | |
| var formats = '(...) ...-....', | |
| formattedPhone = '', | |
| phoneDigits; | |
| if (!phone) { | |
| return; | |
| } else if (phone.substring(0, 1) === '+') { | |
| phoneDigits = phone.substring(2); | |
| } else { | |
| phoneDigits = phone.replace(/[^0-9]/g, ''); |
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
| if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) { | |
| // some code.. | |
| } | |
| $.browser.device = (/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase())); |
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
| javascript | |
| $('.item-a').draggable({'defaultPosition':'top-left'}); | |
| $('.item-b').draggable({'defaultPosition':'bottom-right'}); | |
| $('.item-c').draggable({'defaultPosition':'bottom-left'}); | |
| --> | |
| javascript | |
| $('.items').draggable(); | |
| html |
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
| /*! | |
| * jQuery UI Widget factory "bridge" plugin boilerplate | |
| * Author: @erichynds | |
| * Further changes, additional comments: @addyosmani | |
| * Licensed under the MIT license | |
| */ | |
| // a "widgetName" object constructor |