Skip to content

Instantly share code, notes, and snippets.

@bluejack
bluejack / vuex-state.js
Created November 11, 2018 02:29
A sample state model for a Vuex store
state: {
list: ['key1', 'key2', 'key3'],
items: {
key1: { title: "Title 1"},
key2: { title: "Title 2"},
key3: { title: "Title 3"}
}
}
/*
* This is only going to show a list of the keys themselves.
*
* Expected output:
* - key1
* - key2
* - key3
*/
Vue.component('event-list', {
template: "<div><ul><li v-for='key in list'>{{ key }}</li></div>",
@bluejack
bluejack / list-item-component.js
Created November 11, 2018 05:02
Vue component for items in a list
Vue.component('event-list-item', {
template: "<h4>{{ item.title }}</h4>",
props: {
ikey: {
type: String,
required: true
}
},
data: function() {
return {
@bluejack
bluejack / list-item-nested-components.js
Last active November 11, 2018 07:27
Vue Nested List and Item Component
<DOCTYPE html>
<html>
<head>
<title>Test Vue List</title>
<meta charset='utf-8'>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="https://unpkg.com/vuex"></script>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
</head>
@bluejack
bluejack / array-of-arrays.js
Last active November 12, 2018 17:37
Javascript array of arrays for Ian Brown
var ballots[]
onEvent("submitBtn", "click", function(){
var newBallot = [getNumber("rank1"), getNumber("rank2"), getNumber("rank3"), getNumber("rank4"), getNumber("rank5")]
ballots.push(newBallot)
console.log (newBallot)
console.log ("We now have " + ballots.length + " in our system!"
});
// Here's a little sample to show how you might begin to tabulate the ballots...
function tabulateBallots() {
#!/bin/bash
## Conventions:
##
## Working directory has the same name as the s3 bucket.
## Script is executed from the parent of this directory.
##
BUCKET=$1
service free tier paid req paid duration/storage
API Gateway (12 Months) 1M free $1.00/1M N/A
Lambda (Always) first 1M free; 400k Gb/s $0.20/1M $0.000016667 Gb/s
DynamoDB (Always) first 25G free; 200M $1.25 1M write;$0.25 1M read $0.25/Gb
ELO USCF FIDE
2600 Grandmaster*
2400 and up Senior Master International Master*
2300 Fide Master
2200 National Master Candidate Master
2000 Expert
1800 Class A
1600 Class B
1400 Class C
1200 Class D
Rating Range Level
2800+ World Champion
2600+ Grandmaster
2400+ International Master
2200+ Master
2000+ Expert
1600+ Club player
1300+ Amateur
1000+ Casual
under 1000 Beginner
function load_libaries(client_id, api_key, discovery) {
let goog_ready = false;
let gapi_ready = false;
let pass;
let fail;
let ready = new Promise((res, rej) => {
pass = res;