View validator.js
function validate(obj) {
function validator(prop) {
return function(validateFn) {
var res = validateFn(obj[prop])
if (!Array.isArray(res)) throw 'Validation function must return an array of arrays'
res.forEach(arr => {
if (!Array.isArray(arr)) throw prop + ' validation "' + JSON.stringify(arr) + '" requires a string as first item'
if (typeof arr[0] !== 'string') throw prop + ' validation "' + JSON.stringify(arr) + '" requires a string as first item'
})
var invalidation = res.find(propVal => !propVal[1])
View etc-default-grub
GRUB_DEFAULT=0
# !!! GRUB_HIDDEN_TIMEOUT requires GRUB_TIMEOUT=0
#GRUB_TIMEOUT=5
GRUB_TIMEOUT=0
GRUB_DISTRIBUTOR="Arch"
# !!! add "intel_pstate=disable" to CMDLINE_LINUX_DEFAULT for no CPU sleeps (when NVidia freezes, bad drivers)
# !!! blacklisting nouveau for better proprietary handling
GRUB_CMDLINE_LINUX_DEFAULT="nouveau.blacklist=1 quiet"
GRUB_CMDLINE_LINUX=""
View swallow.js
function swallow(fn) {
return typeof fn !== 'function' ? fn : function (event) {
event.preventDefault()
event.stopPropagation()
return fn(event)
}
}
View interpolated-curry-template.js
function replace(source, params, defaults) {
params = params || {}
return source.replace(/\$\{([^}]*)\}/gm, function (segment, stored, i, string) {
return params[stored] !== void 0 ? params[stored] : defaults[stored]
});
}
function template(source, defaults, options) {
options = options || {interpolate: false};
defaults = defaults || {}
View interpolated-curry-template.js
function replace(source, params, defaults) {
params = params || {}
return source.replace(/\$\{([^}]*)\}/gm, function (segment, stored, i, string) {
return params[stored] !== void 0 ? params[stored] : defaults[stored]
});
}
function template(source, defaults, options) {
options = options || {interpolate: false};
defaults = defaults || {}
View mad-node-modules.md

peer-to-peer

  • peerwiki - all of wikipedia on bittorrent
  • simple-peer - send video/voice/data p2p in the browser (with webrtc)
  • torrent-docker - realtime boot of remote docker images over bittorrent
  • torrent-mount - mount a torrent as a filesystem
  • webtorrent - streaming torrent client for node & the browser

browserify

View arch-install.sh
# a instalacao e iniciada como sudo automaticamente
# define teclado abnt2
loadkeys br-abnt2
# aumenta fonte do terminal
setfont lat4-19
# altera lingua para instalacao
nano /etc/locale.gen
View manual
Somehow, I ended up without any xmodmap files on my Ubuntu install, so I had to find a different approach to this problem.
Take a look at the **xinput** command.
xinput list | grep -i mouse
which lists information about your mouse. It shows my mouse is "Dell Premium USB Optical Mouse" and also that I have "Macintosh mouse button emulation". Armed with that info, I can
xinput get-button-map "Dell Premium USB Optical Mouse"
View toImmutableProxy.js
function toImmutableProxy(any) {
switch(typeof any) {
case 'object':
case 'function':
case 'xml':
return new Proxy(any, {
set: function immutableProxySet(target, prop) {
throw new Error('Cannot set property "' +prop +'", this object is immutable.')
},
View manjaro-install.sh
# Prepare pacman
sudo mkdir -p /root/.gnupg
sudo pacman-key --init && sudo pacman-key --populate archlinux manjaro && sudo pacman-key --refresh-keys
# Remove packages
sudo pacman -R empathy accerciser gnome-chess gnome-sudoku gnome-tetravex polari five-or-more four-in-a-row steam-native ipython hitori gnome-klotski steam quadrapassel gnome-nibbles aisleriot lightsoff gnome-mahjongg gnome-mines iagno gnome-robots tali swell-foop
# Upgrade all
sudo pacman -Syyu