Skip to content

Instantly share code, notes, and snippets.

View ryaninvents's full-sized avatar

Ryan Kennedy ryaninvents

View GitHub Profile
@ryaninvents
ryaninvents / README.md
Created February 1, 2016 16:29
Proxying an app that doesn't want to be proxied

There's an app running at app.test.example.com that I want to make changes to, but I don't want to go through the hassle of getting the source code and getting it set up on my machine. Not when I can fake it with nginx much quicker!

app.test.example.com depends on a service svc.test.example.com. The main JS looks for the environment in the page URL; if I run locally at app.local.example.com it will declare the environment to be "local" and look for a service at svc.local.example.com.

I just have to make sure the service sees what it wants to see: a Host of svc.test.example.com and an Origin of http://app.test.example.com. I also need to keep the browser happy by blocking the Access-Control-Allow-Origin value the service is passing down and using my local one instead.

Works like a charm! Now I can use a try_files directive to selectively replace JS files from the app, and fetch them from the proxied app if they don't exist locally.

@ryaninvents
ryaninvents / esnextbin.md
Last active February 4, 2016 20:41
esnextbin sketch
@ryaninvents
ryaninvents / styleguide.md
Created February 12, 2016 18:50
Proof-of-concept of rendering JS styleguide from a .eslintrc

accessor-pairs

Enforces getter/setter pairs in objects (accessor-pairs)

Setting: 2

/*eslint accessor-pairs: 2*/

var o = { /error Getter is not present/

@ryaninvents
ryaninvents / TIL.md
Last active February 21, 2018 16:47
Today I learned

Computers and software

Networking

DNS

  • Setting a CNAME on a particular subdomain implies that an interested party should look at the other resource for ALL data referring to that subdomain. As such, it will "shadow" any other records, such as MX records, on that subdomain. This is why email breaks when you use CNAME on an apex domain. source 2016-02-12

Applications

@ryaninvents
ryaninvents / involute.scad
Last active February 16, 2016 16:18
Involute gears
// Parametric Involute Bevel and Spur Gears by GregFrost
// It is licensed under the Creative Commons - GNU GPL license.
// © 2010 by GregFrost
// http://www.thingiverse.com/thing:3575
// Simple Test:
//gear (circular_pitch=700,
// gear_thickness = 12,
// rim_thickness = 15,
// hub_thickness = 17,
@ryaninvents
ryaninvents / index.html
Created March 2, 2016 22:09
Avery labels template
<html>
<head>
<style>
.label {
display: inline-block;
text-align: center;
margin: 0 0.25cm 0.05cm;
width: 4in;
height: 2in;
}
@ryaninvents
ryaninvents / index.html
Last active April 21, 2016 14:57 — forked from anonymous/index.html
Smead Viewables tabs
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.1/css/font-awesome.min.css">
<title>JS Bin</title>
<style id="jsbin-css">
@import url(https://fonts.googleapis.com/css?family=Fira+Sans:400,500,700);
@page {
@ryaninvents
ryaninvents / unsubmodule.md
Created May 5, 2016 13:25
Convert git submodule to regular directory

From Stack Overflow.

# Fetch the submodule commits into the main repository
git remote add submodule_origin git://url/to/submodule/origin
git fetch submodule_origin

# Start a fake merge (won't change any files, won't commit anything)
git merge -s ours --no-commit submodule_origin/master
@ryaninvents
ryaninvents / keymap.cson
Created May 10, 2016 19:00
Atom keymap
# Your keymap
#
# Atom keymaps work similarly to style sheets. Just as style sheets use
# selectors to apply styles to elements, Atom keymaps use selectors to associate
# keystrokes with events in specific contexts. Unlike style sheets however,
# each selector can only be declared once.
#
# You can create a new keybinding in this file by typing "key" and then hitting
# tab.
#