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
| <?php | |
| /* | |
| http://php.net/manual/en/regexp.reference.escape.php | |
| The "whitespace" characters are HT (9), LF (10), FF (12), CR (13), and space (32). | |
| However, if locale-specific matching is happening, characters with code points in | |
| the range 128-255 may also be considered as whitespace characters, | |
| for instance, NBSP (A0). |
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
| /* bling.js */ | |
| window.$ = document.querySelectorAll.bind(document) | |
| Node.prototype.on = window.on = function (name, fn) { | |
| this.addEventListener(name, fn) | |
| } | |
| NodeList.prototype.__proto__ = Array.prototype |
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 Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |
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
| <div class="root en"> | |
| <ul class="links"> | |
| <li class="link"> | |
| <a class="link-home"><i class="icon">tag</i>HOME</a> | |
| </li> | |
| <li class="link"> | |
| <a class="link-about"><i class="icon">tag</i>ABOUT</a> | |
| </li> | |
| </ul> |
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() { | |
| var CSSCriticalPath = function(w, d, opts) { | |
| var opt = opts || {}; | |
| var css = {}; | |
| var pushCSS = function(r) { | |
| if(!!css[r.selectorText] === false) css[r.selectorText] = {}; | |
| var styles = r.style.cssText.split(/;(?![A-Za-z0-9])/); | |
| for(var i = 0; i < styles.length; i++) { | |
| if(!!styles[i] === false) continue; | |
| var pair = styles[i].split(": "); |
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 git_branch { | |
| ref=$(git symbolic-ref HEAD 2> /dev/null) || return; | |
| echo "("${ref#refs/heads/}") "; | |
| } | |
| function git_since_last_commit { | |
| now=`date +%s`; | |
| last_commit=$(git log --pretty=format:%at -1 2> /dev/null) || return; | |
| seconds_since_last_commit=$((now-last_commit)); | |
| minutes_since_last_commit=$((seconds_since_last_commit/60)); |
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
| <!DOCTYPE html> | |
| <head> | |
| <title>Stay Standalone</title> | |
| <meta name="apple-mobile-web-app-capable" content="yes"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"> | |
| <script src="stay_standalone.js" type="text/javascript"></script> | |
| </head> | |
| <body> | |
| <ul> | |
| <li><a href="http://google.com/">Remote Link (Google)</a></li> |
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
| /* | |
| * Normalized hide address bar for iOS & Android | |
| * (c) Scott Jehl, scottjehl.com | |
| * MIT License | |
| */ | |
| (function( win ){ | |
| var doc = win.document; | |
| // If there's a hash, or addEventListener is undefined, stop here | |
| if( !location.hash && win.addEventListener ){ |
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
| /* 三个步骤串连起来了 */ | |
| $.Deferred(function (dfd) { | |
| setTimeout(function () {dfd.resolve('step 1');}, 1000); | |
| }).promise() | |
| .then( // then 返回的是个新的 promise 对象 | |
| function (arg) { | |
| console.log('finish ' + arg); | |
| return $.Deferred(function (dfd) { | |
| setTimeout(function (){newDfd.resolve('step 2');}, 1000); | |
| }).promise(); |
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
| <!doctype html> | |
| <html> | |
| <head> | |
| <title>CSS animations: Animation events</title> | |
| <style type="text/css"> | |
| .slidein { | |
| -moz-animation-duration: 3s; | |
| -webkit-animation-duration: 3s; | |
| -moz-animation-name: slidein; | |
| -webkit-animation-name: slidein; |
NewerOlder