Skip to content

Instantly share code, notes, and snippets.

View iliman's full-sized avatar

Ilya Liman iliman

  • Togliatti, Russia
View GitHub Profile
@iliman
iliman / vscode-useful-keyboard-shortcuts.md
Last active August 15, 2018 14:08
VS Code useful keyboard shortcuts

VS Code useful keyboard shortcuts


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
@iliman
iliman / link-keywords-allowed-in-body.md
Created August 2, 2018 11:09
Link element keywords that are allowed in the body
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 );
/**
* 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' ));
//
//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+"')");
// ----------------------------------------------------------
// 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) {}
(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(": ");
// ==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.
@iliman
iliman / uri.js
Last active August 29, 2015 14:16 — forked from jlong/uri.js
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"
@iliman
iliman / rAF.js
Last active August 29, 2015 14:16 — forked from paulirish/rAF.js
// 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'];