Skip to content

Instantly share code, notes, and snippets.

View JamesMessinger's full-sized avatar

James Messinger JamesMessinger

View GitHub Profile
@JamesMessinger
JamesMessinger / swagger.yaml
Created October 21, 2014 03:30
Demonstrating reusing a Swagger operation definition for multiple paths
swagger: "2.0"
info:
version: "1.0.0"
title: CORS demo
description: Demonstrating reusing an operation definition for multiple paths
definitions:
CORS:
summary: CORS Preflight request
tags: [CORS]
responses:
@JamesMessinger
JamesMessinger / asyncForEach.js
Last active August 29, 2015 14:17
Async for loop in JavaScript
/**
* An asynchronous for-each loop
*
* @param {array} array The array to loop through
*
* @param {function} done Callback function (when the loop is finished or an error occurs)
*
* @param {function} iterator
* The logic for each iteration. Signature is `function(item, index, next)`.
* Call `next()` to continue to the next item. Call `next(Error)` to throw an error and cancel the loop.
@JamesMessinger
JamesMessinger / OSXApps.md
Last active January 31, 2022 20:02
James's Great Big List of Great Mac Apps

James’s Great Big List of Great Mac Apps

Apps

  • Chrome ($Free) - Because Safari sucks
  • VLC Media Player ($Free) - Because QuickTime blows
  • Acorn ($30) - Photoshop for humans
  • Airmail ($10) - An excellent email client, supports Gmail, Yahoo, Hotmail, Exchange, etc.
  • Twitter ($Free) - Twitter's official Mac client. It's pretty great.
@JamesMessinger
JamesMessinger / IndexedDB101.js
Last active May 19, 2024 18:56
Very Simple IndexedDB Example
// This works on all devices/browsers, and uses IndexedDBShim as a final fallback
var indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB || window.shimIndexedDB;
// Open (or create) the database
var open = indexedDB.open("MyDatabase", 1);
// Create the schema
open.onupgradeneeded = function() {
var db = open.result;
var store = db.createObjectStore("MyObjectStore", {keyPath: "id"});
@JamesMessinger
JamesMessinger / circular-refs.js
Created July 16, 2015 03:31
JSON Schema Circular $Refs
{
"definitions": {
"thing": {
"$ref": "#/definitions/thing" // circular reference to self
},
"person": {
"properties": {
"name": {
"type": "string"
},
@JamesMessinger
JamesMessinger / NewsArticle.yaml
Last active July 31, 2018 09:13
Example of using `allOf` to extend an object in a Swagger API
swagger: "2.0"
info:
version: "1.0.0"
title: minimal
description: News Articles ftw
paths:
/users:
get:
responses:
"200":

SailsJS v1.0

This is just a list of changes that I would like to see in SailsJS v1.0. Many of these are breaking changes, but this is a major version bump, so now is the time to make these changes. It’s worth the upgrade pain to make some much-needed improvements to the framework and remove some legacy bloat and code smell.

Top Priorities:

Upgrade to Express 4.0

  • Or Express 5.0, if it’s at least in beta by then

Trim-down SailsJS Core by moving a bunch of stuff to plug-ins (hooks)

  • Remove Grunt, EJS, and LESS from SailsJS Core
@JamesMessinger
JamesMessinger / README.md
Last active March 9, 2024 17:58
VSCode GitHub Markdown Theme

GitHub Markdown Theme for Visual Studio Code

This CSS stylesheet allows you to preview markdown files in VSCode using GitHub's mardown theme. This CSS was taken directly from the official GitHub Markdown repo. I replaced their top-level .markdown-body class with the body tag so it would work in VSCode, and added styling for the html tag to match GitHub's fixed-width container.

Instructions

  1. Copy the CSS file to your computer
    Copy the github-markdown.css file below to your computer. You can put it anywhere you want, but I chose to put it in the same folder as my VSCode settings file.

  2. Edit your VSCode settings
    If you want to use this theme for all of your projects, then edit your User Settings file. If you just want to use this them

@JamesMessinger
JamesMessinger / json-pointer-example-1.yaml
Created April 15, 2016 15:25
This example demonstrates a simple URL-encoded JSON Pointer in a Swagger 2.0 API definition
swagger: "2.0"
info:
version: 1.0.0
title: Example
paths:
"/foo":
get:
responses:
200:
@JamesMessinger
JamesMessinger / json-pointer-example-2.yaml
Created April 15, 2016 15:27
This example demonstrates a URL-encoded JSON Pointer in a Swagger 2.0 API definition
swagger: "2.0"
info:
version: 1.0.0
title: Blog
paths:
"/blogs/{id}/posts":
parameters:
- name: "id"
in: "path"
type: "integer"