Skip to content

Instantly share code, notes, and snippets.

function displayPerson(person, hasFreeCoffee) {
const coffeeTableEl = document.getElementById("coffeeTable");
coffeeTableEl.innerHTML =
coffeeTableEl.innerHTML +
`
<tr>
<td>${person.name}</td>
<td>${person.age}</td>
<td>${person.numbersOfCoffees}</td>
<td>${hasFreeCoffee ? "Yes" : "No"}</td>
@lwcooper
lwcooper / addroutes.js
Last active June 24, 2020 21:23
react router
{/* A <Switch> looks through its children <Route>s and
renders the first one that matches the current URL. */}
<Switch>
<Route path="/about">
<About />
</Route>
<Route path="/users">
<Users />
</Route>
<Route path="/">
@lwcooper
lwcooper / keybase.md
Created March 21, 2018 18:52
keybase id

Keybase proof

I hereby claim:

  • I am lwcooper on github.
  • I am lwcooper (https://keybase.io/lwcooper) on keybase.
  • I have a public key ASAQ7ZQ60pnBiPLc0OmuKxlrWTcDtvCdpPD3jphgzAOkPwo

To claim this, I am signing this object:

@lwcooper
lwcooper / Docker cheatsheep
Created February 21, 2018 01:51
Common docker commands I keep forgetting
# Remove all images
docker rmi $(docker images -a -q)
# Stop and remove all containers
docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
# Remove volumes
docker volume ls
docker volume rm volume_name
@lwcooper
lwcooper / gist:246a46902e5bc11c151c84f0f69a3612
Created October 31, 2017 00:05
Get content from Prismic.io for static site generator
// You can run this script as part of your build step in your package.json
// eg:
// ...
// "scripts": {
// "build": "node get-content.js && hugo"
// }
// ...
var fs = require('fs'); //to access filewrite
var toMarkdown = require ('to-markdown'); //to convert HTML to Markdown
@lwcooper
lwcooper / loop.js
Last active September 6, 2017 02:45
async while loop
function fetchUsersFromCognito (options) {
const defaults = {
UserPoolId: AWS_COGNITO_USER_POOL_ID
};
const params = Object.assign({}, defaults, options);
return new Promise((resolve, reject) => {
client.listUsers(params, (error, data) => {
if (error) {
reject(error);
@lwcooper
lwcooper / keybase.md
Created June 20, 2017 23:33
Verifying keybase.io

Keybase proof

I hereby claim:

  • I am lwcooper on github.
  • I am lwcooper (https://keybase.io/lwcooper) on keybase.
  • I have a public key ASBOd0fVzm3ieUt-evUwErujkcSrpJonojg3uifrjGjPwgo

To claim this, I am signing this object:

@lwcooper
lwcooper / 0_reuse_code.js
Created January 12, 2017 04:55
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@lwcooper
lwcooper / dabblet.css
Last active August 29, 2015 14:17
Grid
/**
* Grid
*/
.hero,
.main {
box-sizing: border-box;
}
/* Content faking */
@lwcooper
lwcooper / dabblet.css
Created July 23, 2014 02:54 — forked from anonymous/dabblet.css
Untitled
.img-wrapper {
width: 300px;
height: 150px;
overflow: hidden;
position: relative;
float: left;
margin: 20px;
}
img {