Skip to content

Instantly share code, notes, and snippets.

const handler = <T>(
users: Array<T>,
metaData: Array<MockResponse>,
authFn: (Auth, T) => bool,
respondFn: (T) => Object,
req: $Request,
res: $Response,
) => {
const eitherAuth = validateAuth(req.body)
if (eitherAuth instanceof Error) {
@LoganBarnett
LoganBarnett / bar.js
Created November 16, 2017 19:00
Use a dependency-injection like function to make mocking easier
// Generally I suffix these variables with "Fn" so I know I have to call it before I can use the interesting bits.
const fooFn = require('./foo.js')
const aws = require('aws')
// Variant 1: This is the simplest thing that can happen.
fooFn(aws.send)
// Variant 2: If send is a method and not a function (implicit "this"), then we need to bind it. Simply passing send doesn't include its "this" context. Functions have a bind function that produces a new function with the binding you want.
fooFn(aws.send.bind(aws))
// Variant 3: Perhaps the send function has some parameters in it that are very AWS specific, or maybe even environment specific. We can move any kind of configuration send would need into the responsibilities of this file, and then foo.js just cares about when the right time to invoke/handle send is. Again, bind is our friend here. The first argument is the context or the "this" reference (see variant 2 above). The following rest args are parameters are a "baked" into the function that results from bi
@LoganBarnett
LoganBarnett / foo.html
Last active July 7, 2017 20:23
This is an example of using the angular-react directive.
<div class="test-spacer" tabindex="-1" >
<!-- method A: the actual component name is supplied by name.
Must be registered using Angular's module.value function.
`props` supplied via the props attribute as a full object.
-->
<react-component name="Btn" props="reactButton"></react-component>
<!-- method B: the react component becomes a first class component.
Must be registered with Angular's module.directive function.
`props` are specified with a one-to-one attribute->prop mapping.
-->
try {
// the foo declaration is hoisted out of the try block so it can be accessible later
var foo = await getAsyncFoo()
}
catch(e) {
console.error('oh noes!', e.message)
}
foo.doSomeThings()
@LoganBarnett
LoganBarnett / button.css
Created May 11, 2017 22:37
showing off css modules
.delete {
background-color: #a33;
border-style: none;
border-radius: 1em;
color: #DDD;
font-size: 0.75em;
padding: 0.25em 0.75em;
display: inline-block;
margin: 0.25em 0.25em;
border: none;
@LoganBarnett
LoganBarnett / messenger.com.css
Last active January 29, 2017 08:53
dark theme for Facebook messenger
@namespace url(http://www.w3.org/1999/xhtml);
/* #141823 is Messenger's normal text colour, white is normal background colour */
/* #1E1E1E and #2D2D30 are Visual Studio, don't ask */
/* timestamp of message list bar */
.timestamp {
color: white !important;
}
function outer1() { function inner(){console.log('inner')} console.log('outer1'); inner(); outer2() }
function outer2() { console.log('outer2') }
outer1()
outer2()
const outer3 = () => { console.log('outer3'); outer4(); }
const outer4 = () => { console.log('outer4') }
@LoganBarnett
LoganBarnett / generator.css
Created July 23, 2016 02:41
CSS modules in action
.detailsContainer {
/* padding: 1em; */
background-color: #222;
border: 1em solid #1a1a1a;
display: flex;
flex-direction: row;
}
.container {
background-color: #333;
@LoganBarnett
LoganBarnett / lambda-funk.js
Created July 15, 2016 18:42
demonstrate lambda binding issues - i will always be 10
var funcs = []
for(var i = 0; i < 10; ++i) {
funcs.push(function() { console.log('i is ' + i) })
}
funcs.forEach(function(f) { f() })
  • Get some bullet points of what needs to be done at a high level.
  • Definition of Continuous Delivery
  • Some reading/watching materials
  • Examples of shops doing Continuous Delivery

Definition

Continuous Delivery brings about an incredibly short iteration cycle in the software development process. It focuses on delivering frequent but small releases directly to the customer with the intent of getting customer feedback before too many resources are wasted on a feature that's undesired.