Keybinding | Command |
---|---|
Ctrl + Shift + L |
Select similar instances |
Ctrl + Shift + K |
Delete the entire line |
F2 |
Rename all instances |
Ctrl + Shift + I |
Format the entire document |
Ctrl + K -> Ctrl + L |
Format selection only |
Ctrl + / |
Toggle commenting |
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 myprefix_add_async_attr( $tag, $handle ) { | |
if ( 'my-script' !== $handle ) { | |
return $tag; | |
} | |
return str_replace( ' src', ' async src', $tag ); | |
} | |
add_filter( 'script_loader_tag', 'myprefix_add_async_attr', 10, 2 ); |
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
/** | |
* Never worry about cache again! | |
*/ | |
function my_load_scripts($hook) { | |
// create my own version codes | |
$my_js_ver = date("ymd-Gis", filemtime( plugin_dir_path( __FILE__ ) . 'js/custom.js' )); | |
$my_css_ver = date("ymd-Gis", filemtime( plugin_dir_path( __FILE__ ) . 'style.css' )); | |
// |
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
//Your SVG | |
var mySVG = '<svg xmlns:osb="http://www.openswatchbook.org/uri/2009/osb" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" height="20" width="20"><defs><linearGradient osb:paint="solid"><stop offset="0"/></linearGradient><linearGradient osb:paint="solid"><stop offset="0"/></linearGradient><marker orient="auto" overflow="visible"><path d="M-10 0l-4 4L0 0l-14-4 4 4z" fill-rule="evenodd" stroke="#000" stroke-width=".8pt"/></marker><marker orient="auto" overflow="visible"><path d="M10 0l4-4L0 0l14 4-4-4z" fill-rule="evenodd" stroke="#000" stroke-width=".8pt"/></marker></defs><g fill="none" fill-rule="evenodd" stroke="#aaa" stroke-width="1.868"><path d="M.66.66l18.68 18.68"/><path d="M19.34.66L.66 19.34"/></g></svg>'; | |
//Generate base64 svg | |
var mySVG64 = window.btoa(mySVG); | |
//Get your base64 svg in console | |
console.log("url('data:image/svg+xml;base64,"+mySVG64+"')"); |
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 short snippet for detecting versions of IE in JavaScript | |
// without resorting to user-agent sniffing | |
// ---------------------------------------------------------- | |
// If you're not in IE (or IE version is less than 5) then: | |
// ie === undefined | |
// If you're in IE (>=5) then you can determine which version: | |
// ie === 7; // IE7 | |
// Thus, to detect IE: | |
// if (ie) {} |
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() { | |
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 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
// ==UserScript== | |
// @name Use Markdown, sometimes, in your HTML. | |
// @author Paul Irish <http://paulirish.com/> | |
// @link http://git.io/data-markdown | |
// @match * | |
// ==/UserScript== | |
// If you're not using this as a userscript just delete from this line up. It's cool, homey. |
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 parser = document.createElement('a'); | |
parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
parser.protocol; // => "http:" | |
parser.hostname; // => "example.com" | |
parser.port; // => "3000" | |
parser.pathname; // => "/pathname/" | |
parser.search; // => "?search=test" | |
parser.hash; // => "#hash" | |
parser.host; // => "example.com:3000" |
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
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/ | |
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating | |
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel | |
// MIT license | |
(function() { | |
var lastTime = 0; | |
var vendors = ['ms', 'moz', 'webkit', 'o']; |