Skip to content

Instantly share code, notes, and snippets.

🎩
Ask Me Good Questions

ADoyle adoyle-h

🎩
Ask Me Good Questions
Block or report user

Report or block adoyle-h

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
@ChrisChares
ChrisChares / AsyncAwaitGenerator.md
Last active Jul 9, 2019
async/await with ES6 Generators & Promises
View AsyncAwaitGenerator.md

async/await with ES6 Generators & Promises

This vanilla ES6 function async allows code to yield (i.e. await) the asynchronous result of any Promise within. The usage is almost identical to ES7's async/await keywords.

async/await control flow is promising because it allows the programmer to reason linearly about complex asynchronous code. It also has the benefit of unifying traditionally disparate synchronous and asynchronous error handling code into one try/catch block.

This is expository code for the purpose of learning ES6. It is not 100% robust. If you want to use this style of code in the real world you might want to explore a well-tested library like co, task.js or use async/await with Babel. Also take a look at the official async/await draft section on desugaring.

Compatibility

  • node.js - 4.3.2+ (maybe earlier with
View CURL常用命令.md
@sw-yx
sw-yx / adaptive_intent.md
Created May 3, 2019
an adaptive, intent based CLI "state machine"
View adaptive_intent.md

an adaptive, intent based CLI "state machine"

one realization from working on Netlify's CLI is that the CLI framework we used, oclif, didn't provide a great user experience out of the box.

Emphasis on great: it does a lot of nice things, like offering flag and argument parsing, help documentation, and pluggability. That's good for the CLI developer. But what about the CLI user?

  • Idiomatic oclif code often checks for required preconditions, and if it doesn't exist, it prints a warning and then process.exit(1).
  • Decent code prints a helpful warning telling the user what they got wrong. It is informative.
  • Better code offers a prompt, creates a file, or something similar to solve the precondition before proceeding. (possibly recursively). It is intent-based.
  • Great code remembers past inputs to prompts and uses that to offer useful defaults. It is adaptive.
@handerson
handerson / mysqlfix.sh
Created Mar 27, 2012 — forked from davejlong/mysql client
How to setup the MySQL client and MySQLDump client on Mac OS x from MySQL Workbench
View mysqlfix.sh
#MySQL Client
ln -s /Applications/MySQLWorkbench.app/Contents/Resources/mysql /usr/bin/mysql
#MySQL Dump
ln -s /Applications/MySQLWorkbench.app/Contents/Resources/mysqldump /usr/bin/mysqldump
#How to fix the "Library not loaded: libmysqlclient.18.dylib (LoadError)" error
sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib
@bomberstudios
bomberstudios / sketch-diff-in-git.md
Last active Nov 8, 2019
How to diff your .sketch files in Git
View sketch-diff-in-git.md

Using sketchtool to diff your .sketch files using text

Requirements

You need to have SketchTool installed somewhere in your path.

Setup

Add this in your ~/.gitconfig file (for some reason, it won't work in a local .gitconfig file):

@tanb
tanb / xhyve-freebsd-tutorial-1.md
Last active Nov 9, 2019
FreeBSD running on xhyve tutorial. (Appendix: Resize image with qemu. Create FreeBSD VM with qemu).
View xhyve-freebsd-tutorial-1.md

TL;DR

  • Create 5GB FreeBSD image.
  • Install FreeBSD on xhyve.
  • Mount host directory.

Requisites

@robertkowalski
robertkowalski / npm-registry-licenses.txt
Created Nov 23, 2013
The licenses in the npm-registry from their package.json, from the latest version of each module 23.11.2013
View npm-registry-licenses.txt
The licenses in the npm-registry from their package.json, from the latest version of each module
23.11.2013
[ { key: 'undefined', value: 27785 },
{ key: 'MIT', value: 20811 },
{ key: 'BSD', value: 5240 },
{ key: 'BSD-2-Clause', value: 621 },
{ key: 'Apache 2.0', value: 263 },
{ key: 'GPL', value: 233 },
@benjamingr
benjamingr / gist:0237932cee84712951a2
Last active Dec 2, 2019
Promise unhandled rejection tracking global handler hook
View gist:0237932cee84712951a2

Possibly Unhandled Rejection NodeJS Promise Hook

###Unhandled Rejection Tracking

Several promise libraries such as bluebird and when as well as some native promise implementations offer potentially unhandled rejection tracking. This means that the following:

Promise.reject(new Error("err")); // never attach a `catch`
@loderunner
loderunner / 01-mac-profiling.md
Last active Dec 9, 2019
Profiling an application in Mac OS X
View 01-mac-profiling.md

Profiling an application in Mac OS X

Finding which process to profile

If your system is running slowly, perhaps a process is using too much CPU time and won't let other processes run smoothly. To find out which processes are taking up a lot of CPU time, you can use Apple's Activity Monitor.

The CPU pane shows how processes are affecting CPU (processor) activity:

View git-author-rewrite.sh
#!/bin/sh
git filter-branch --env-filter '
OLD_EMAIL="your-old-email@example.com"
CORRECT_NAME="Your Correct Name"
CORRECT_EMAIL="your-correct-email@example.com"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
You can’t perform that action at this time.