Skip to content

Instantly share code, notes, and snippets.

View mikermcneil's full-sized avatar
🦢

Mike McNeil mikermcneil

🦢
View GitHub Profile
@mikermcneil
mikermcneil / send-socket-request-from-ionic.js
Last active April 3, 2018 16:37
wrapper around sails.io.js (Sails.js socket.io client) for Ionic framework (circa 2017-2018 anyway). See https://gitter.im/balderdashy/sails?at=5ac146392b9dfdbc3a4620e1 for context
/**
* Module dependencies
*/
var _ = window['_'];
var io = window['io'];
import flaverr from './flaverr';
@mikermcneil
mikermcneil / parasails.sublime-syntax
Last active March 24, 2023 17:47
Syntax highlight template literals as HTML in Sublime Text 3 for Vue.js components, Vue app instances, or other client-side JavaScript. Particularly useful for the .page.js and .component.js files in your Sails app or other Parasails project. No grunt-ing, gulp-ing, webpack-ing, brunch-ing, or supper required.
%YAML 1.2
---
# parasails.sublime-syntax
#
# Syntax highlight template literals as HTML in Vue components (standalone and inline).
# Automatically enabled for .component.js and .page.js files.
# (Designed for use with client-side JavaScript for your Vue.js, Sails.js,
# or Parasails app-- but could be used anywhere-- even on the server via Node.js.)
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
@mikermcneil
mikermcneil / 2-kinds-of-procedural-parameters.md
Last active December 20, 2017 03:31
Seems to me there are two varieties of procedural parameters out there: "leases" and "consequences".

2 kinds of procedural parameters

Seems to me there are two varieties of procedural parameters out there: "leases" and "consequences".

Examples

Procedures (generic)

@mikermcneil
mikermcneil / sublime-3-settings.js
Created December 11, 2017 08:43
My settings for Sublime 3 (press CMD+, to get here)
{
"binary_file_patterns":
[
"*.jpg",
"*.jpeg",
"*.png",
"*.gif",
"*.ttf",
"*.tga",
"*.dds",
@mikermcneil
mikermcneil / whats-the-big-deal.md
Last active March 24, 2026 17:21
What's the big deal with Node.js and `await`?

What's the big deal with Node.js and await?

So I really don't like most new things. The only reason I even got involved with Node.js early on was because of its sweeping promise: "One language, spoken by developers across the world." By consolidating parallel efforts, it would accelerate the pace of innovation, and quickly lead to more transformative and disruptive developer tools. It would create tremendous value for software businesses by unlocking efficiencies in the hiring and implementation process. And best of all everyone would waste less time on boring stuff.

Still, there was a problem. While it's true most developers have touched some JavaScript callbacks up there in browserland, in the bowels of the application server, there tends to be a lot more asynchronous things going on. And that causes all sorts of issues. All those callbacks also make for a way steeper

@mikermcneil
mikermcneil / pause.js
Last active December 21, 2017 01:46
that thing everyone needs now, if you're using `await` on the front-end. Obvious caveat: Don't actually use this without babel et al
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// UPDATE:
//
// If you're using a Sails app, and you need to do this on the backend, then instead of the code below,
// consider just using `sails.helpers.flow.pause()` from sails-hook-organics.
// (Now available by default in the "Web App" template.)
//
//
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@mikermcneil
mikermcneil / smry
Created November 4, 2017 16:16
Gist for iterating over files in a particular folder and checking their git status
#!/bin/bash
# smry
#
# Copyright Nov 4, 2017, Mike McNeil
# MIT License
#
# Adapted from https://gist.github.com/lmj0011/1a8dd1e376234ac7bf0fba2748ecdd0f
# and https://gist.github.com/mzabriskie/6631607#gistcomment-1738920
# which was originally adapted from https://gist.github.com/mzabriskie/6631607
@mikermcneil
mikermcneil / latest-open-source-misc-package-README-boilerplate.md
Last active November 3, 2017 20:09
latest template for the bottom of READMEs

Help

If you have a question, need commercial support from the engineers who build Sails, or you just want to talk Sails/Node.js with other folks in the community, click here.

Bugs   NPM version

To report a bug, click here.

@mikermcneil
mikermcneil / setting-up-cloudflare-and-heroku-with-ssl
Last active June 5, 2019 19:43
For future reference: When attempting to set up cloudflare and heroku properly with SSL, here's how you do it.
For future reference: When attempting to set up cloudflare and heroku properly, here's how you do it:
1. Just buy the dingdang SSL cert through Cloudflare.
2. Enable Cloudflare's built-in https:// redirect functionality.
3. Use the "Full" SSL setting in Cloudflare
4. In Cloudflare, have your DNS set up to point at the normal/default DNS setting (not the special SSL one!)
5. Don't do anything related to SSL in heroku (or in your app logic)
> If you choose "Partial" SSL in Cloudflare or start monkeying around with SSL in Heroku, things get kind of weird.
echoSinceTagInfo()
{
if git describe --abbrev=0 --tags 1>/dev/null 2>/dev/null;
then
local LAST_TAG=`git describe --abbrev=0 --tags`;
local CHANGED_SINCE_LAST_TAG=`git diff ${LAST_TAG} --shortstat`;
if [ -z "${CHANGED_SINCE_LAST_TAG}" ]
then