Skip to content

Instantly share code, notes, and snippets.

View ryaninvents's full-sized avatar

Ryan Kennedy ryaninvents

View GitHub Profile
@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)
}
@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",
@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

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 {
@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%;
@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>
@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',
@PurpleBooth
PurpleBooth / README-Template.md
Last active June 8, 2025 06:27
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

@ryaninvents
ryaninvents / fix-npm.sh
Last active March 26, 2016 16:33
Fix npm global install
# This script is the **correct** way to allow installation and use
# of npm executables without sudo.
# Declare where you want your global packages installed to.
npm config set prefix '~/.local/share/npm'
# Ensure the directory exists.
mkdir -p ~/.local/share/npm
# Change `.zshrc` to `.bashrc` if appropriate, but consider instead
@maximilianschmitt
maximilianschmitt / readme.md
Last active August 29, 2015 14:19
Making your io.js command line apps compatible with node.js