Skip to content

Instantly share code, notes, and snippets.

View MrRhodes's full-sized avatar
👨‍💻
Technologying

Stephen Rhodes MrRhodes

👨‍💻
Technologying
View GitHub Profile
@MrRhodes
MrRhodes / index.ts
Created July 9, 2024 11:22
load balancer listening on one port but routing to a different port with Pulumi and AWS crosswalk
const alb = new awsx.lb.ApplicationLoadBalancer("loadbalancer", {
defaultTargetGroup: {
port: 3000,
healthCheck: { // optional
port: "3000",
},
},
listener: {
port: 80,
},
@MrRhodes
MrRhodes / test.js
Created August 2, 2017 20:40
Should not find conditionally rendered child?
import React from 'react';
import { shallow } from 'enzyme';
class ConditionalParent extends React.Component {
render() {
return !!this.props.visible && (<div>{this.props.children}</div>);
}
}
class Child extends React.Component {
const initialState = new Immutable.Map({
email: '',
password: '',
isLoggingIn: false,
isLoggedIn: false,
error: null
});
export default function user(state = initialState, action) {
switch (action.type) {
@MrRhodes
MrRhodes / testing.1.js
Last active July 21, 2016 15:24
testing.1
describe("user api tests", function() {
it("should add a new user to the database", function(done) {
api.put('/user/123')
.then(response => {
assert.equal(response.statusCode, 201)
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
<style id="jsbin-css">
table {
border-collapse:collapse;
}
@MrRhodes
MrRhodes / gist:5f3d60c2c26148b514aa
Created January 8, 2015 21:23
Array filter chaining for a basic "rules" implementation.... (not run this code, so might have errors, but you get the idea)
var items = [
...
];
var satisfied = items
.filter(condition1(5))
.filter(condition2('camel'))
.filter(condition3)
function condition1(something) {
@MrRhodes
MrRhodes / gist:72181ea03bf1ed94f37a
Created December 16, 2014 23:28
Trying to write a simple next/last day thingy with Moment.
var moment = require('moment');
function Datey() {
this.date = moment();
this.modifier = 1;
return this;
}
Datey.prototype.last = function() {
this.modifier = -1;