Skip to content

Instantly share code, notes, and snippets.

View brettstack's full-sized avatar

Brett Andrews brettstack

View GitHub Profile
@lg
lg / cloudy-gamer-launcher.sh
Last active April 28, 2021 14:25
Easily start/stop Paperspace and Parsec instances
#!/bin/bash
#
# CloudyGamerLauncher by Larry Gadea
# Easily start/stop Paperspace and Parsec instances
#
# Make sure to fill out the variables below. For the machine id, use the
# 8-letter identifier for the machine on Paperspace (ex. PS8RGDUY)
#
# Note: Requires Paperspace API key (generate one in account settings)
@HyperBrain
HyperBrain / lifecycle-cheat-sheet.md
Last active March 20, 2024 00:17
Serverless Lifecycle Cheat Sheet

Serverless plugin author's cheat sheet

This cheat sheet provides a detailed overview of the exposed lifecycle events and available commands (and entrypoints) of the Serverless framework, that can be hooked by plugins (internal and external ones). The document is structured by the commands invoked by the user.

Lifecycle events are shown as the globally available outer events (all providers) and sub lifecycle events that are provider specific in the called order. Currently only the AWS provider is shown. If you have information about the other provider,

@acdlite
acdlite / app.js
Last active January 20, 2023 08:23
Quick and dirty code splitting with React Router v4
// getComponent is a function that returns a promise for a component
// It will not be called until the first mount
function asyncComponent(getComponent) {
return class AsyncComponent extends React.Component {
static Component = null;
state = { Component: AsyncComponent.Component };
componentWillMount() {
if (!this.state.Component) {
getComponent().then(Component => {
@nolanlawson
nolanlawson / protips.js
Last active February 4, 2024 18:06
Promise protips - stuff I wish I had known when I started with Promises
// Promise.all is good for executing many promises at once
Promise.all([
promise1,
promise2
]);
// Promise.resolve is good for wrapping synchronous code
Promise.resolve().then(function () {
if (somethingIsNotRight()) {
throw new Error("I will be rejected asynchronously!");
@cobyism
cobyism / gh-pages-deploy.md
Last active April 18, 2024 13:44
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@Raynos
Raynos / a.md
Created January 23, 2012 19:48
Shim status of ES6

ES6 what can be shimmed and what not.

Currently only lists things that can be shimmed or are experimentally implemented

Note that for any kind of decent ES6 support we need an ES6 transpiler. A few projects are attempting this [Reference SO question][3]

  • [traceur][4]
  • [Caja][5]
  • [ES transpiler][6]