Skip to content

Instantly share code, notes, and snippets.

Alvaro Cabrera Durán pateketrueke

Block or report user

Report or block pateketrueke

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
pateketrueke / Hakifile.js
Last active Dec 4, 2018
Hakifile.js example
View Hakifile.js
module.exports = haki => {
haki.setGenerator('the:truth', {
description: "Display if it's true, or not",
arguments: ['verb', 'value'],
abortOnFail: true,
actions(input) {
const { verb, value } = input;
if (verb === 'is' && parseInt(value, 10) === 42) {
View extract-xml.php
$start = memory_get_usage(true);
define('INPUT_FILE', $argv[1]);
define('IS_DECODE', array_search('--decode', $argv) !== false);
if (!is_file(INPUT_FILE)) {
echo "Invalid or missing input.\n";
echo "Usage: php extract-xml.php download.xml [--decode]\n";
pateketrueke /
Created May 18, 2018
Extract ENV vars from JSON files
set -eu
echo "$( tr '\n' ' ' < vars.json | jq -r 'keys[] as $k | "export \($k)=\"\(.[$k])\""' )"
# usage:
# ./ > .env
#. source .env
# echo "$SOME_ENV_VALUE"
pateketrueke / lvm_apt_get.txt
Created May 9, 2018
Mount and install through LVM
View lvm_apt_get.txt
vgchange -a y
mkdir /newroot
mount /dev/yourVG/rootLV /newroot
mount /dev/yourbootpartition /newroot/boot
mount -o bind /dev /newroot/dev
mount -o bind /sys /newroot/sys
mount -o bind /var /newroot/var
mount -o bind /proc /newroot/proc
pateketrueke /
Created Feb 2, 2018
Una lista de definiciones, el drama.


Dada la lista de definiciones de abajo:

pateketrueke /
Created Jan 17, 2018
Patch sinon-stubs for v2

Given sources with similar content:

anySymbolHere.stub(anObject, stringRef, hoistedFn);
anySymbolHere.stub(anObject, 'anyMethodCallAsString', () => true);

Execute the following command in your terminal:

sed -i '' 's/.stub(\(.*\), \(.*\));/.stub(\1).callsFake(\2);/g' *.js

pateketrueke / application.css
Last active Apr 4, 2018
JSON Schema Resource
View application.css
hr,iframe{border:0}.is-loading,select{background-repeat:no-repeat}.button-group a,.field-item>a,a{text-decoration:none}.info-table,.json-table,table{border-collapse:collapse}html{box-sizing:border-box}*,:after,:before{box-sizing:inherit}body,html{height:100%}blockquote,body,dd,dl,dt,fieldset,figure,h1,h2,h3,h4,h5,h6,hr,html,iframe,legend,li,ol,p,pre,textarea,ul{margin:0;padding:0}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:400}ul{list-style:none}button,input,select,textarea{margin:0}.json-form,hr{margin-bottom:12px}audio,embed,iframe,img,object,video{height:auto;max-width:100%}table{border-spacing:0}td,th{padding:0;text-align:left}a,body,button,input{font-family:Helvetica;color:#000}svg{max-width:1em;max-height:1em}svg.big{max-width:1.5em;max-height:1.5em}svg.small{max-width:.75em;max-height:.75em}small{color:#aaa;font-size:.8em}a{color:#999}a:hover{color:#000}a:hover svg{fill:#000}.has-icon>a svg,.has-icon>span svg,a svg{fill:#999}a svg{vertical-align:middle}hr{border-top:1px dashed #aaa;margin-top:12px}but
View grown.js
'use strict';
const IS_LIVE = process.argv.slice(2).indexOf('--live') > -1;
const Grown = require('./_plugs/grown');
pateketrueke / vue-template-compiler-bug.js
Created Apr 2, 2017
Ctor.toString() breaks on environments where Reflect.ownKeys is undefined (e.g. node v4.8.1)
View vue-template-compiler-bug.js
// this "can" simulate the real issue behind
global.Reflect = global.Reflect || {};
global.Reflect.ownKeys = null;
// this will call `Ctor.toString()` at some point,
// and there will be dragons (fix with String(Ctor) huh?)
setup() {
SITE_CONF="$(cat $SRC/$1/Caddyfile)"
SITE_HOST="$(cat $SRC/$1/HOSTS)"
SITE_CONF="$(echo "$SITE_CONF" | sed "s/localhost/$SITE_HOST/g" )"
You can’t perform that action at this time.