把 Caps Lock 變成智慧的 Control 以及 Escape :
- 單獨輕按一下就是 Escape 。
- 若按下時同時按著其他鍵,就會是 Control 。
這應該是 Vim 和 Emacs 的最佳解了!(Emacs? Bash 的快捷鍵就是 Emacs 系列的)
- Send Escape if you tap Caps Lock alone.
<? | |
function sort_nested_arrays( $array, $args = array('votes' => 'desc') ){ | |
usort( $array, function( $a, $b ) use ( $args ){ | |
$res = 0; | |
$a = (object) $a; | |
$b = (object) $b; | |
foreach( $args as $k => $v ){ | |
if( $a->$k == $b->$k ) continue; |
/** | |
* JSS | |
* Author: Jared Abbott | |
* Copyright 2015 Jared Abbott | |
* Distributed under the MIT license | |
* | |
* @param {Object} | |
*/ | |
var _jss = function(jss, combinator) { | |
var _toString = Function.prototype.call.bind(Object.prototype.toString); |
/*! | |
* xhrBinary.js | |
* Author: Jared Abbott | |
* Copyright 2015 Jared Abbott | |
* Distributed under the MIT license | |
*/ | |
var xhrBinary = function(url, fn) { | |
// RESOURCES | |
// http://mgran.blogspot.com/2006/08/downloading-binary-streams-with.html |
// Author: Jared Abbott | |
// Created: December 2015 | |
// License: MIT | |
var template = function(tpl, data) { | |
// Make sure the cache is available | |
var w = window; | |
w.tplCache = !w.tplCache ? {} : w.tplCache; | |
// Prepare and load the template | |
tpl = ('"' + tpl.replace(/\{\{(.*?)\}\}/g, '"+$1+"') + '"').split(/\'+ | + \'/); |
(function(){ | |
var cache = {}; | |
this.tmpl = function tmpl(str, data){ | |
// Figure out if we're getting a template, or if we need to | |
// load the template - and be sure to cache the result. | |
var fn = !/\W/.test(str) ? | |
cache[str] = cache[str] || | |
tmpl(document.getElementById(str).innerHTML) : |
# powershell XOR encoder / decoder and hex / byte - byte / hex conversions | |
# usage: execute & see output | |
# xor encoder / decoder | |
function xor($bytes, $string) { | |
$newBytes = @(); | |
for ($i = 0; $i -lt $bytes.Count; $i++) { | |
$newBytes += $bytes[$i] -bxor $string[$i % $string.Length]; | |
} | |
return $newBytes; |
(function() { | |
var cache = {}; | |
this.tmpl = function tmpl(str, data) { | |
// Figure out if we're getting a template, or if we need to | |
// load the template - and be sure to cache the result. | |
var fn = !/\W/.test(str) ? | |
cache[str] = cache[str] || | |
tmpl(document.getElementById(str).innerHTML) : |
/* | |
This comes directly from John Resig's MicroTemplating, but with {%= %} instead of <%= %> for the dynamic sections. | |
http://ejohn.org/blog/javascript-micro-templating/ | |
This lets you use just natural Javascript, along with whatever JS library you're using, and can be inside of a Rails erb template, or whatever. | |
Used with a template inside the HTML of the page: | |
<script type="text/html" id="user_tmpl"> |