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 str1 = '0100100001100101011011000110110001101111001000000101011101101111011100100110110001100100'; | |
var str2 = '0111000001101100011001010110000101110011011001010010000001110100011000010110110001101011001000000111010001101111001000000110110101100101'; | |
var str3 = '011011000110100101100110011001010010000001110010011010010110011101101000011101000010000001101110011011110111011100100000011010010111001100100000011011000110111101101110011001010110110001111001'; | |
var binStr2ASCII = (str) => { | |
return str.match(/[01]{8}/g).map(x => String.fromCharCode(parseInt(x, 2))).join(''); | |
}; | |
var testStrs = [str1, str2, str3]; |
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
// Open all links on a page in new tab -- for MBW | |
// Requires ECMAScript 6's `Set()` for getting unique urls | |
// I'm too lazy to write a `uniq` function nor do I want to pull in a 3rd party lib | |
// Works in Firefox 25+, Chrome 38+, Opera 25+, Safari 7.1+, Internet Explorer 11+ | |
new Set( | |
Array.prototype.filter.call(document.querySelectorAll('a[href],area[href]'), function(acc, el) { | |
el.href[0] !== '#' && acc.push(el) | |
return acc | |
}, []) | |
).forEach(function(href) { |
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
// requires Ramda (http://ramdajs.com/) | |
// urlParser : String -> Object | |
;urlParser = (function(document, R) { | |
"use strict"; | |
const {fromPairs, pipe, reduce, replace, split} = R; | |
let parser = document.createElement("a"); | |
// searchToKeyVal : String -> Object |
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
if !1 | finish | endif | |
if has('vim_starting') | |
set nocompatible " Be iMproved | |
" Required: | |
set runtimepath+=~/.vim/bundle/neobundle.vim/ | |
endif |
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
;; User behaviors | |
;; ----------------------------- | |
;; Behaviors are stored as a set of diffs that are merged together | |
;; to create the final set of functionality that makes up Light Table. You can | |
;; modify these diffs to either add or subtract functionality. | |
;; | |
;; Behaviors are added to tags, objects with those tags then automatically gain | |
;; whatever logic the behavior imparts. To see a list of user-level behaviors, | |
;; start typing a word related to the functionality you want in between the square | |
;; brackets (e.g. "theme"). |
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
# Prefix to Ctrl-a like `screen` | |
set -g prefix C-a | |
bind C-a send-prefix | |
unbind C-b | |
set -sg escape-time 1 | |
set -g base-index 1 | |
setw -g pane-base-index 1 | |
# Mouse works as expected |
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
let data = | |
[ [{value: 0}, {value: 3}, {value: "c"}] | |
, [{value: 2}, {value: 1}, {value: "a"}] | |
, [{value: 1}, {value: 2}, {value: "b"}] | |
, [{value: 1}, {value: 3}, {value: "b"}] | |
]; | |
let sorter = [[1, false], [2, false]]; |
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
/* | |
* Element.matches() | |
* https://developer.mozilla.org/en-US/docs/Web/API/Element/matches | |
* The Element.matches() method returns true if the element would be selected | |
* by the specified selector string; otherwise, returns false. | |
* | |
* Prefixed Support: Android 2.2, Internet Explorer 9, Edge 12, Safari 5.0 | |
* Unprefixed Support: Chrome 34, Firefox 34, Safari 7.1, iOS Safari 8.0 | |
*/ |
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
// Well the string building is pretty dopey with the `+=` append on | |
// a forEach instead of a map, but that slice on the last char sends | |
// shivers of cringe up my spine. | |
_.mixin({ | |
param: function(obj) { | |
var param = ""; | |
_.forEach(obj, function(val, key) { | |
param += key + "=" + val + "&"; | |
}); |
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
(into [:dl] | |
(map #(vector %1 %2) (cycle [:dt :dd]) (flatten (vec (clojure.walk/stringify-keys {:test "me" :foo "bar"}))))) | |
;=> [:dl [:dt "test"] [:dd "me"] [:dt "foo"] [:dd "bar"]] |
OlderNewer