Skip to content

Instantly share code, notes, and snippets.

View brianleroux's full-sized avatar
💚
You are now aware that you are breathing

Brian LeRoux brianleroux

💚
You are now aware that you are breathing
View GitHub Profile
@brianleroux
brianleroux / bootstrap-fixed-urls.js
Created February 2, 2018 22:34
Use _url helper to resolve weird API Gateway URLS.
module.exports = function layout(params) {
let {body, _url, title} = params
return `
<!doctype html>
<html lang="en">
<head>
<meta charset=utf-8>
<meta name=viewport content=width=device-width,initial-scale=1,shrink-to-fit=no>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<title>${title}</title>
@brianleroux
brianleroux / index.js
Created February 2, 2018 22:23
An arc.codes route handler that uses bootstrap
const arc = require('@architect/functions')
const layout = require('@architect/shared/views/bootstrap')
function route(req, res) {
let html = layout({
title: 'My App',
body: `
<div class=jumbotron>
<h1 class=display-4>Add to Slack</h1>
<p class=lead>Install this app to start using it in Slack.</p>
@brianleroux
brianleroux / bootstrap.js
Created February 2, 2018 22:22
Judge not lest thee be judged.
module.exports = function bootstrap(params) {
let {body, title} = params
return `
<!doctype html>
<html lang="en">
<head>
<meta charset=utf-8>
<meta name=viewport content=width=device-width,initial-scale=1,shrink-to-fit=no>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<title>${title}</title>
function interpolateParams(req) {
var params = /\{\w+\}/g
if (params.test(req.path)) {
var matches = req.path.match(params)
var vars = matches.map(a=> a.replace(/\{|\}/g, ''))
var idx = 0
matches.forEach(m=> {
req.path = req.path.replace(m, req.params[vars[idx]])
idx += 1
/* eslint no-undef: "off", no-restricted-globals: "off" */
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.slack=f()}})(function(){var define,module,exports;return(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){},{}],2:[function(require,module,exports){var api=require('./api.json')
module.exports=function _bind(ns,exec){Object.keys(
.navigation {
width: 100%;
height: 100%;
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 0;
list-style: none;
#!/bin/sh
lambdas=`ls src/json`
for f in $lambdas
do
cd "src/json/$f"
npm i --production
cd ../../../
done
lambdas=`ls src/html`
const Slack = require('slack')
const token = process.env.SLACKBOT_TOKEN
const bot = new Slack({token})
let result = await bot.api.test({hello:'world'})
console.log(result)
var params = {
DistributionConfig: { /* required */
CallerReference: 'STRING_VALUE', /* required */
Comment: 'STRING_VALUE', /* required */
DefaultCacheBehavior: { /* required */
ForwardedValues: { /* required */
Cookies: { /* required */
Forward: none | whitelist | all, /* required */
WhitelistedNames: {
Quantity: 0, /* required */
@brianleroux
brianleroux / .arc
Last active August 10, 2017 16:41
an example diff between arc and cloudformation
@app
testapp
@html
get /