Skip to content

Instantly share code, notes, and snippets.

View ryaninvents's full-sized avatar

Ryan Kennedy ryaninvents

View GitHub Profile
@PurpleBooth
PurpleBooth / README-Template.md
Last active June 9, 2025 10:37
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@dagingaa
dagingaa / prototype-to-class.js
Last active December 23, 2022 11:38
Codemod to transform well-written function prototype style classes into the new ES2015 syntax. Requires jscodeshift.
module.exports = (file, api, options) => {
const j = api.jscodeshift;
const root = j(file.source);
// We have to add "use strict" for node to play nice
// Taken from https://github.com/cpojer/js-codemod/blob/master/transforms/use-strict.js
const hasStrictMode = body =>
body.some(
statement => j.match(statement, {
type: 'ExpressionStatement',
@stesie
stesie / index.html
Created April 1, 2016 22:28
AWS IoT-based serverless JS-Webapp Pub/Sub demo
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>AWS IoT Pub/Sub Demo</title>
</head>
<body>
<h1>AWS IoT Pub/Sub Demo</h1>
<form>
<button type="button" id="connect">connect!</button>
@ramiroaznar
ramiroaznar / index.html
Last active September 30, 2022 02:36
How to create an interactive heatmap with Leaflet.js
<html>
<head>
<title>How to create an interactive heatmap with Leaflet.js</title>
<meta charset="utf-8">
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.js"></script>
<script src="leaflet-heat.js"></script>
<style type="text/css">
html, body, #map{
height: 100%;

Solutions to problems or quirks I shouldn't have.

Web dev

Stack overflow in React (`Maximum call stack size exceeded`) Triggered this one a week ago with something like the following (pseudocode):
class MyComponent extends React.Component {
@ryaninvents
ryaninvents / phaser.js
Last active August 15, 2016 15:55 — forked from crisu83/phaser.js
Wrapper module for running Phaser.js on Node.js.
// this is an ingenius hack that allows us to run Phaser without a browser
// ... and yes, it took some time to figure out how to do this
var Canvas = require('canvas')
, jsdom = require('jsdom')
, document = jsdom.jsdom(null)
, window = document.parentWindow
, Phaser;
// expose a few things to all the modules
@keeth
keeth / api.tf
Last active January 13, 2021 14:34
Apex + Terraform + AWS Lambda + API Gateway + JSON Encoded Errors + CORS
resource "aws_api_gateway_rest_api" "myApi" {
name = "myApi-${var.env}"
description = "My awesome API (${var.env} environment)"
}
resource "aws_api_gateway_deployment" "myApi" {
depends_on = [
"aws_api_gateway_integration.myApi_myEndpoint_post",
"aws_api_gateway_integration_response.myApi_myEndpoint_post",
"aws_api_gateway_integration_response.myApi_myEndpoint_post_400",
@dersam
dersam / gitkraken.zsh
Last active March 13, 2025 01:32
Open GitKraken using the current repo directory in the cli.
## Open GitKraken using the current repo directory.
## For when you want a prettier view of your current repo,
## but prefer staying in the cli for most things.
## This will break if GitKraken ever removes the -p flag.
## If you're not using OSX, the path is definitely different.
kraken () {
~/Applications/GitKraken.app/Contents/MacOS/GitKraken -p $(pwd)
}
@sombriks
sombriks / bar.js
Last active March 30, 2017 16:07
mocha+chai+budo+nightmare
"use strict"
const Nightmare = require("nightmare");
const expect = require("chai").expect;
const budo = require("budo");
describe("\u263C basic tests \u263E", () => {
const b = budo("../src/main.js");
@marcosnakamine
marcosnakamine / example_feed_xml_rss.xml
Created March 22, 2017 20:20
Google Merchant - Feed example in xml
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<rss xmlns:g="http://base.google.com/ns/1.0" version="2.0">
<channel>
<title>Example - Online Store</title>
<link>http://www.example.com</link>
<description>
This is a sample feed containing the required and recommended attributes for a variety of different products
</description>
<!--
First example shows what attributes are required and recommended for items that are not in the apparel category