Skip to content

Instantly share code, notes, and snippets.

View dsernst's full-sized avatar
🧘‍♂️
practicing mindfulness

David Ernst dsernst

🧘‍♂️
practicing mindfulness
View GitHub Profile
@dsernst
dsernst / intro_to_promises.md
Last active January 26, 2016 11:40
Notes for a quick presentation to introduce other developers to Promises

Promises

Why?

  • reclaim simple synchronous control flow like return & throw
  • easier to write and maintain
  • banish callback hell

How?

@dsernst
dsernst / gmail-datetime-to-isodate.js
Created January 26, 2016 02:18
Convert a Gmail datetime into an ISODate for Mongo
// Convert a Gmail datetime into an ISODate for Mongo
function gmailToIso(string) {
return 'ISODate("' + new Date(string.split('at ').join('')).toISOString() + '")'
}

https://www.youtube.com/watch?v=U3_VUWWh7iw

  • white indents are the ones I wasn't with him for
    • Miami
  • Dallas
  • Somewhere near Portland (Oregon)
    • Campbell Falls (Massachusetts)
  • Chicago
  • Glacier National Park (Montana)
  • Thermopiles (Wyoming)
@dsernst
dsernst / fun-things-around-sf.md
Created December 29, 2015 18:53
Fun things in San Francisco

Fun things in San Francisco

A friend was visiting town so we were coming up with some of the best things to show him in San Francisco. These are some of my favorites:

  • Palace of Fine Arts
  • Walking around civic center / downtown / Financial District
  • Cable cars
  • Ocean Beach
  • Sutro Baths & Lands End
  • exploring Golden Gate Park
@dsernst
dsernst / talk-ideas.md
Created December 29, 2015 18:38
Longer Hack Reactor Lecture ideas

Longer Hack Reactor Lecture ideas:

  • Famous problems in computer science
  • how to send encrypted messages
  • passwords are obsolete
  • important events in the history of open-source
  • the earliest computers
  • why do people care about bitcoin?
  • Gödel's Incompleteness Theorem
  • most common biases that confuse our thinking
@dsernst
dsernst / atom-stylesheet.less
Created October 8, 2015 22:18
My custom style modifications to Atom
/*
* Your Stylesheet
*
* This stylesheet is loaded when Atom starts up and is reloaded automatically
* when it is changed and saved.
*
* Add your own CSS or Less to fully customize Atom.
* If you are unfamiliar with Less, you can read more about it here:
* http://lesscss.org
*/
@dsernst
dsernst / stache-calc.js
Last active October 8, 2015 08:15
Code to calculate weekly 'stache growth
/* eslint-env node */
module['exports'] = function echoHttp (hook) {
console.log('hook.req', hook.req.method)
// console.log('hook.params', hook.params['attachment-1']['body-plain'])
console.log('hook.params', hook.params)
if (hook.req.method === 'POST') {
console.log('in POST request')
}
@dsernst
dsernst / osx_dockerhost.sh
Created October 8, 2015 07:22
Use `dockerhost` instead of the IP of your docker-machine vm
echo $(docker-machine ip default) dockerhost | sudo tee -a /etc/hosts
@dsernst
dsernst / say-before.git.sh
Created September 5, 2015 22:30
Example of modifying git to do something else before it runs
# Add this to the top of your .bash_profile
git () {
say "git";
/usr/local/bin/git "$@";
}
@dsernst
dsernst / measure-logging-speeds.md
Last active September 5, 2015 03:46
Speed testing node's default console.log, versus an async logger, versus no logging.

Tested with the looping going up to n <= 65

node-simplelogger: 12.2s (with slight delay after it finished printing before the process ended)
no logging: 10.6s
console.log: 12.8s

These measurements came from adjust line 33 of this file: https://github.com/dsernst/ProjectEuler/blob/67a9c17f0810ff6a5da5c20c027e8c11c7a0c304/53%20Combinatoric%20selections.js#L33

The point of these tests were to see if using an asyncronous logger would be faster than node's built in console. In this case, it did not make a meaningful difference.