Skip to content

Instantly share code, notes, and snippets.

💭
🍕

David Morrow dperrymorrow

💭
🍕
Block or report user

Report or block dperrymorrow

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 json-highlight.js
import { escape } from "lodash";
export default function(str, format = true) {
try {
// ensure that we got valid json here...
const obj = JSON.parse(str);
if (format) str = JSON.stringify(obj, null, 2);
str = _parseObj(obj, str);
// dont wrap with the parent tag till we are done...
return `<span class="json-markup">${str}</span>`;
@dperrymorrow
dperrymorrow / user-settings.json
Last active Dec 15, 2018
vscode settings.json
View user-settings.json
{
"window.zoomLevel": 1,
"editor.fontFamily": "LigaMonaco, Monaco, 'Courier New', monospace",
"editor.fontSize": 13,
"editor.lineHeight": 19,
"editor.renderLineHighlight": "all",
"editor.fontLigatures": true,
"atomKeymap.promptV3Features": true,
"editor.formatOnPaste": true,
"editor.folding": false,
View sampleTrack.js
context.commit("setPage", [
{
title: "hello there",
created_timestamp: "2018-06-06 22:23:48.324468-07",
updated_timestamp: "2018-06-06 22:23:48.324468-07",
targets: [{ lang: "en" }],
meta: {
user_assignment: {},
track: { songId: "sdfsdf", artistNames: [] },
},
@dperrymorrow
dperrymorrow / elsintrc.json
Created May 29, 2018
eslint configuration
View elsintrc.json
{
"root": true,
"parserOptions": {
"ecmaVersion": 8
},
"plugins": [
"prettier",
"unicorn",
"promise",
"html"
View eslint.json
{
"root": true,
"parserOptions": {
"ecmaVersion": 8
},
"plugins": [
"prettier",
"unicorn",
"promise"
],
View routeData.vue
<template lang="pug">
.user-edit(v-if="dataLoaded")
//- your data is ready
</template>
<script>
import TethysVue from "@welocalize/tethys-vue";
export default {
@dperrymorrow
dperrymorrow / test.js
Last active Aug 14, 2017
stubbing @welocalize/pantheon-api-sdk
View test.js
const test = require("ava");
const sinon = require("sinon");
const SDK = require("@welocalize/pantheon-api-sdk");
const getJwt = sinon.stub(SDK, "getJwt");
test("stubbing a success of getJwt", t => {
const payload = { data: "foobar" };
getJwt.returns(Promises.resolve(payload));
});
@dperrymorrow
dperrymorrow / git log
Created May 8, 2017
git log as yaml format
View git log
git log --format='-- %nsha: %H %nauthor: %an %nemail: %ae %ndata: %ar %nsubject: %s%nbody: %b'
View invoice.html
<div class="invoice-simple document">
<!-- Page 1 -->
<div class="page">
<header>
<img src="../../assets/images/park-logo.png"></img>
<div class="doc-type">ESTIMATE</div>
</header>
<footer>
<strong>Park IP Reference number:</strong>
@dperrymorrow
dperrymorrow / promiseCatching.js
Created Mar 16, 2017
example of catching, what will throw an error and what will not
View promiseCatching.js
function failingPromise() {
throw new Error('foobar');
return Promise.resolve(4);
}
// works fine not in chain, error is thrown
failingPromise()
.then(num => {
console.log(num);
});
You can’t perform that action at this time.