Skip to content

Instantly share code, notes, and snippets.

View pateketrueke's full-sized avatar

Alvaro Cabrera Durán pateketrueke

View GitHub Profile
@pateketrueke
pateketrueke / AWSECommerce.json
Last active June 2, 2016 00:12
JSON-Schema Faker / dereferencing issues / see #28 #80
{
"id": "http://webservices.amazon.com/AWSECommerceService/2013-08-01#",
"definitions": {
"ItemLookupRequest": {
"type": "object",
"title": "ItemLookupRequest",
"properties": {
"condition": {
"title": "condition",
"allOf": [{
[
{ "keys": ["ctrl+shift+<"], "command": "focus_side_bar" },
{ "keys": ["ctrl+<"], "command": "toggle_side_bar" },
{ "keys": ["ctrl+tab"], "command": "next_view" },
{ "keys": ["ctrl+shift+tab"], "command": "prev_view" },
{ "keys": ["ctrl+pageup"], "command": "next_view" },
{ "keys": ["ctrl+pagedown"], "command": "prev_view" },
{ "keys": ["ctrl+t"], "command": "show_overlay", "args": {"overlay": "goto", "show_files": true} },
{ "keys": ["ctrl+7"], "command": "toggle_comment", "args": { "block": false } },
{ "keys": ["ctrl+shift+7"], "command": "toggle_comment", "args": { "block": true } }
@pateketrueke
pateketrueke / package.json
Created March 9, 2016 06:15
Disallow empty objects from generated values
{
"dependencies": {
"json-schema-faker": "git+https://github.com/json-schema-faker/json-schema-faker.git#prune-empty-props"
}
}

Dependencies

  • npm i tarima-cli [engines] -ES

Where [engines] are the following described in the README.

{
  "scripts": {
@pateketrueke
pateketrueke / README.md
Created July 9, 2016 23:28
Tarima + Express

Write the following view-script:

src/example.js.hbs.pug

h1 {{value}}

Execute npm start.

#!/bin/bash
SRC="$HOME/sites"
DEST="/etc/caddy"
setup() {
SITE_CONF="$(cat $SRC/$1/Caddyfile)"
SITE_HOST="$(cat $SRC/$1/HOSTS)"
SITE_CONF="$(echo "$SITE_CONF" | sed "s/localhost/$SITE_HOST/g" )"
@pateketrueke
pateketrueke / vue-template-compiler-bug.js
Created April 2, 2017 08:02
Ctor.toString() breaks on environments where Reflect.ownKeys is undefined (e.g. node v4.8.1)
// 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?)
require('vue-template-compiler');
@pateketrueke
pateketrueke / grown.js
Last active November 9, 2017 10:27
Grown v1 DSL
'use strict';
const IS_LIVE = process.argv.slice(2).indexOf('--live') > -1;
require('debug').enable('*');
const Grown = require('./_plugs/grown');
Grown.use(require('./_plugs/router'));
Grown.use(require('./_plugs/test'));
@pateketrueke
pateketrueke / application.css
Last active April 4, 2018 03:36
JSON Schema Resource
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
@pateketrueke
pateketrueke / sinon-stubs-fix.md
Created January 17, 2018 00:15
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