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
/* If the block begins with the `highlightLines: []` directive, strip that off, | |
parse the array as JSON, and pass the lines to Shiki. | |
Replaces single quotes with doubles, because I know I'm gonna screw that up. | |
Valid formats include: | |
highlightLines:[] | |
highlightLines [] | |
// highlightLines: [] |
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
#!/usr/bin/env ruby | |
require 'open3' | |
# Copy the SVG from Sketch, then run this | |
# It will clean up the SVG, insert bind:this={whatever} for any objects named `b:whatever` in the svg, | |
# and print out the variables to declare in Svelte | |
# To use: | |
# 1. copy the SVG from Sketch |
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
<!-- Twitter Cards --> | |
<meta name="twitter:title" content="{% if page.title %}{{ page.title }}{% else %}{{ site.title }}{% endif %}"> | |
{% if page.excerpt %}<meta name="twitter:description" content="{{ page.excerpt | strip_html }}">{% endif %} | |
{% if site.owner.twitter %}<meta name="twitter:site" content="@{{ site.owner.twitter }}">{% endif %} | |
{% if author.twitter %}<meta name="twitter:creator" content="@{{ author.twitter }}">{% endif %} | |
{% if page.image.twitter %} | |
<meta name="twitter:card" content="summary_large_image"> | |
<meta name="twitter:image" content="{{ site.url }}/images/{{ page.image.twitter }}"> | |
{% elsif page.image.feature %} | |
<meta name="twitter:card" content="summary_large_image"> |
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
{ | |
"Insert a function": { | |
"prefix": "f", | |
"body": [ | |
"function $1($2) {\n $0\n}\n" | |
], | |
"description": "Insert a function" | |
}, | |
"const arrow": { | |
"prefix": "c>", |
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
#!/bin/bash | |
# Print usage if args are missing | |
if [ -z $1 ]; then | |
echo "Usage: new-post <slug>" | |
exit | |
fi | |
SLUG=$1 | |
DAY=$(date +%Y-%m-%d) |
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
export default class App extends React.Component { | |
... | |
componentDidMount() { | |
Permissions.askAsync(Permissions.CAMERA) | |
.then(({ status }) => | |
this.setState({ | |
cameraPermission: status === 'granted' | |
}) | |
); |
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
class Autoshoot extends React.Component { | |
state = { | |
photo: null | |
} | |
... | |
} |
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 PHOTO_INTERVAL = 30000; | |
const FOCUS_TIME = 3000; | |
class Autoshoot extends React.Component { | |
componentDidMount() { | |
this.countdown = setTimeout( | |
this.takePicture, | |
PHOTO_INTERVAL | |
); | |
} |
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
// Store the single image in memory. | |
let latestPhoto = null; | |
// Upload the latest photo for this session | |
app.post('/', (req, res) => { | |
// Very light error handling | |
if(!req.body) return res.sendStatus(400); | |
console.log('got photo') |
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
render() { | |
const { photo } = this.state; | |
return ( | |
<Camera | |
style={{ flex: 1 }} | |
type={Camera.Constants.Type.back} | |
ref={cam => this.camera = cam}> | |
<TouchableOpacity | |
style={{ flex: 1 }} |