This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Typescript erroring: | |
--- | |
Type 'Promise<(T | undefined)[] | [any, undefined]>' is not assignable to type 'Promise<[void | Error, void | T]>'. | |
Type '(T | undefined)[] | [any, undefined]' is not assignable to type '[void | Error, void | T]'. | |
Type '(T | undefined)[]' is not assignable to type '[void | Error, void | T]'. | |
Target requires 2 element(s) but source may have fewer.ts(2322) | |
*/ | |
export default function <T> (promise: Promise<T>): Promise<[Error | void, T | void]> { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function findAnnotations (field:Block | Inline):Array<Block | Inline> { | |
const annotations:Array<Block | Inline> = [] | |
// `field.content` returns Block | Inline | Text | |
// I’d like to ignore Text | |
// `reduce` is showing a TypeScript error "This expression is not callable" because Text isn’t included | |
// but if I add it, `node.content` errors because Text doesn’t have `.content` | |
return field.content.reduce((acc:Array<Block | Inline>, node:Block | Inline) => { | |
if (node.nodeType === INLINES.EMBEDDED_ENTRY && node.data.target.sys.contentType.sys.id === 'annotation') { | |
acc.push(node.data.target) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
computed: { | |
now () { | |
return new Date | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
data () { | |
return { | |
now: new Date | |
} | |
}, | |
created () { | |
setInterval(() => this.now = new Date, 1000 * 60) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
computed: { | |
...mapState('time', ['now']) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import startOfDay from 'date-fns/start_of_day' | |
const getters = { | |
today (state) { | |
return startOfDay(state.now) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const state = { | |
now: new Date | |
} | |
const actions = { | |
start ({ commit }) { | |
setInterval(() => { | |
commit('updateTime') | |
}, 1000 * 60) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gulp = require('gulp'); | |
var svgSprite = require('gulp-svg-sprite'); | |
gulp.task('svgs', function() { | |
return gulp.src('./app/assets/images/**/*.svg') | |
.pipe(svgSprite({ | |
transform: [{ | |
svgo: { | |
plugins: [{ removeUnknownsAndDefaults: false }] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var gulp = require('gulp'); | |
var browserify = require('browserify'); | |
var source = require('vinyl-source-stream'); | |
var buffer = require('vinyl-buffer'); | |
var uglify = require('gulp-uglify'); | |
var coffeeify = require('coffeeify'); | |
var shim = require('browserify-shim'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<rss version="2.0" xml:base="{{ site.permalink }}"> | |
<channel> | |
<title>{{ site.title | xml_escape }}</title> | |
<link>{{ site.permalink }}</link> | |
<description>{{ site.description | xml_escape }}</description> | |
<pubDate>{{ site.date | date_to_rfc822 }}</pubDate> | |
{% for post in site.pages.journal.posts limit: 10 %} | |
<item> | |
<title>{{ post.title | xml_escape }}</title> |
NewerOlder