Skip to content

Instantly share code, notes, and snippets.

// http://www.2ality.com/2013/09/javascript-unicode.html
function toUTF16(codePoint) {
var TEN_BITS = parseInt('1111111111', 2);
function u(codeUnit) {
return '\\u'+codeUnit.toString(16).toUpperCase();
}
if (codePoint <= 0xFFFF) {
return u(codePoint);
}
@namklabs
namklabs / 0_reuse_code.js
Created October 24, 2016 16:33
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@namklabs
namklabs / terminus-search-replace.sh
Last active April 1, 2016 14:19 — forked from wpscholar/terminus-search-replace.sh
WP-CLI Search and Replace via Terminus (on Pantheon)
terminus wp "search-replace 'find' 'replace' --dry-run" --site=mysite --env=dev|test|live
@namklabs
namklabs / trimText.js
Last active August 29, 2015 14:20 — forked from Edukanezza/trimText.js
// Trim text.
/*
- Respects word boundaries by default (will not chop a word up to create ellipses by default).
- Allows for ellipses or no ellipses.
*/
function trimText( jquery_obj_to_trim, int_trim_length, bool_ellipses, bool_respect_word_boundaries ){
var ellipses;
if( typeof bool_ellipses === "undefined" ){
alert(([][[]]+[])[!+[]+!![]+!![]+!![]]+([]
[[]]+[])[+[]]+(!![]+[])[+[]]+([][[]]+[])
[+[]]+([]+{})[!+[]+!![]]+([][[]]+[])[!
+[]+!![]+!![]+!![]+!![]]+(![]+[])[!+[]+!!
[]]+([][[]]+[])[!+[]+!![]+!![]]+([][[]]+[])
[!+[]+!![]+!![]]+(!![]+[])[+[]])
[
{ "keys": ["ctrl+tab"], "command": "next_view" },
{ "keys": ["ctrl+shift+tab"], "command": "prev_view" }
]
$.fn.equalheight = function( remove ) {
// Reset heights from the last viewport resize so that values do not get wacky-large.
this.height('auto');
// if remove is true, just reset the heights and return
if ( remove ) {
return;
}