Skip to content

Instantly share code, notes, and snippets.

View IanVS's full-sized avatar

Ian VanSchooten IanVS

View GitHub Profile
@IanVS
IanVS / 00-SANE-Deployment.md
Last active August 29, 2015 14:24
SANE Deployment Strategies

SANE deployment

You’ve created a web app using the SANE stack (using an Ember.js client and a Sails.js API), and now you’re ready to get it out there for the world to see. There are many ways to handle deployments, with varying complexity and tradeoffs. This series of posts will present a few of those methods, with increasing levels of complexity, for deploying your app to AWS. There are many options of where to deploy your app, including Heroku, Firebase, DigitalOcean, AWS, and others. I’ve chosen to use AWS as it is currently the largest and most well-known.

@IanVS
IanVS / pre-commit
Created March 23, 2016 13:02
Git pre-commit hook to perform linting on only the changes which will be committed.
#!/bin/bash
#
# A hook script to perform linting before allowing a commit,
# to avoid unnecessary noise or extra work to rebase commits.
# Based on: http://stackoverflow.com/a/20480591/1435658
# Necessary to support .nvm and gitx
export PATH=/usr/local/bin/:$PATH
@IanVS
IanVS / react-select_v2.x.x.js
Created September 5, 2019 00:12
react-select v2 flowtype definitions
/* @flow */
declare module 'react-select' {
import type {
ComponentType,
Element as ReactElement,
ElementRef,
Node,
Ref,
} from "react";
@IanVS
IanVS / no-react-default-import.js
Last active March 14, 2023 22:34
Custom eslint rule to prevent default import of React.
module.exports = {
meta: {
type: 'suggestion',
fixable: 'code',
schema: [],
},
create(context) {
return {
ImportDeclaration(node) {
if (
@IanVS
IanVS / README.md
Created April 25, 2023 13:27
A modified version of the react/jsx-no-target-blank ESLint rule which adds config for allowed hostnames

jsx-no-target-blank

This custom ESLint rule is based on a rule from eslint-plugin-react, but it adds one additional option to allowlist hostnames in external links.

Motivation

I want to be able to use target="_blank" links for documentation articles (a site I control), and I want to keep referrer for analytics purposes. See jsx-eslint/eslint-plugin-react#2941 (comment).

New option: allowedHostnames

@IanVS
IanVS / [lang]slash[slug].astro
Created November 9, 2021 15:05
Redirecting i18n pages in Astro
---
import Layout from '../../layouts/MainLayout.astro';
import {getLanguageFromFilename, getSlugFromFilename} from '../../languages';
export async function getStaticPaths() {
/**
* This builds up a set of params using the filename (which is always in english) as the slug,
* and adds a redirect prop to the proper internationalized slug.
*/
function getRedirects(allPages) {