Skip to content

Instantly share code, notes, and snippets.


Dan Harper danharper

Block or report user

Report or block danharper

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
danharper / vscode-settings.js
Last active Aug 18, 2018
italic operator mono
View vscode-settings.js
"editor.fontFamily": "Operator Mono, Menlo, Monaco, 'Courier New', monospace",
"editor.fontSize": 13,
"window.zoomLevel": 0,
"editor.tabSize": 2,
"editor.fontLigatures": true,
"workbench.colorTheme": "Default Light+",
"editor.cursorBlinking": "solid",
"editor.minimap.enabled": false,
"editor.tokenColorCustomizations": {
View release.js
const { execSync } = require('child_process')
const SENTRY_URL = ''
const SENTRY_API_KEY = process.env.SENTRY_API_KEY
const VERSION = process.env.CIRCLE_SHA1
function createSentryRelease() {
execSync(`curl ${SENTRY_URL} -u ${SENTRY_API_KEY} -X POST -d '${JSON.stringify({ version: VERSION })}' -H 'Content-Type: application-json'`)
function uploadToSentry(file, filename) {
danharper / voices.js
Last active Oct 7, 2016
cycle every SpeechSynthesis voice
View voices.js
// would've been awesome if `speechSynthesis.speak` returned a promise which resolves on finish.. :(
const sleep = ms => new Promise(r => setTimeout(r, ms))
async function go(msg) {
for (let v of speechSynthesis.getVoices()) {
speechSynthesis.speak(u = new SpeechSynthesisUtterance(msg), u.voice = v, u)
await sleep(1000)
danharper / RCC-001 PinToBottom.diff
Last active Jun 17, 2016
@ReactJSTraining Challenges
View RCC-001 PinToBottom.diff
const { render, findDOMNode } = ReactDOM
// Only code you need to change is inside this component
class PinToBottom extends React.Component {
static propTypes = {
danharper /
Created Jun 16, 2016
building an ionic/cordova android app on ubuntu. actually using circle, but needed to test something out on a fresh box
# starting with a Ubuntu 14 box on AWS
# increase swap
sudo fallocate -l 4G /swapfile
ls -lh /swapfile
sudo chmod 600 /swapfile
ls -lh /swapfile
sudo mkswap /swapfile
View ScrollSpy.ts
export type Options = {
blockSelector: () => string,
linkSelector: (id: string) => string,
classToToggle?: () => string,
toggleClass?: (el: Element, isInView: boolean, classToToggle: string) => void,
View babel-browser.html
<!DOCTYPE html>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<div id="main"></div>
danharper / normalize-filenames.js
Last active Aug 17, 2018 — forked from dcramer/normalize-filenames.js
use Sentry (Raven) on PhoneGap
View normalize-filenames.js
Raven.config(dsn, {
dataCallback(data) {
const normalize = filename => filename.split('/www/', 2)[1]
data.exception.values[0].stacktrace.frames.forEach(frame => {
frame.filename = normalize(frame.filename)
data.culprit = data.exception.values[0].stacktrace.frames[0].filename
danharper / TimestampToDate.scpt
Last active Oct 8, 2015 — forked from clooth/TimestampToDate.scpt
Applescript to display real date of selected timestamp
View TimestampToDate.scpt
on run {input, parameters}
tell application "System Events"
set activeApp to name of first process whose frontmost is true
end tell
set _timestamp to (input as string)
tell application activeApp
set realDate to ((do shell script "date -r " & _timestamp) as string)
danharper / waitFor.js
Last active Feb 21, 2017
three ways to "waitFor" a prop to become non-null before rendering
View waitFor.js
// decorate the class, composition
function waitFor(prop) {
return ChildComponent => class extends Component {
render() {
return this.props[prop] ? <ChildComponent {...this.props} /> : null
// decorate the class, inheritance
You can’t perform that action at this time.