This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Application } from "https://deno.land/x/oak/mod.ts"; | |
import { applyGraphQL, gql } from "https://deno.land/x/oak_graphql/mod.ts"; | |
const app = new Application(); | |
const types = gql` | |
type Dino { | |
name: String | |
image: String | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// conditional ? expression1 : expression2 | |
// Variable assignments | |
const num = 20 | |
const numDescription = num > 9 ? "10 or bigger" : "less than 10"; | |
console.log("num is " + numDescription) | |
// Returning values | |
function getCost(isMember) { | |
return isMember ? '$1.00' : '$2.00'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.error('Debug messages...'); | |
function canBrew(inventory, order) { | |
const canBrew = true | |
for(const [index, delta] of order.deltas.entries()) { | |
if(delta > inventory[index]){ | |
canBrew = false | |
} | |
} | |
return canBrew | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module['exports'] = function myHook (hook) { | |
var request = require('request'); | |
request.get( | |
"http://someurl.com", | |
function(err, res){ | |
var index = res.body.indexOf('off">'); | |
var time = parseInt(res.body.substring(index + 5, index + 8)); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const numbers = [1, 2, 3]; | |
const sum = numbers.reduce((acc, number) => { | |
console.log(acc, number); | |
return acc + number; | |
}, 0); | |
console.log(sum); | |
const multiplication = numbers.reduce((acc, number) => { | |
console.log(acc, number); | |
return acc + number; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const app = require('express')(); | |
// Heroku header fixes | |
app.use(function (req, res, next) { | |
res.setHeader( | |
'Access-Control-Allow-Origin', | |
'http://' + req.headers.host + ':8100', | |
); | |
res.setHeader( | |
'Access-Control-Allow-Methods', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lifx: | |
light: | |
server: 192.168.1.106 | |
broadcast: 192.168.1.255 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"buckets": [ | |
"Not important to Me", | |
"Somewhat important to Me", | |
"Important to Me", | |
"Very important to Me", | |
"Most important to Me" | |
], | |
"cards": [ | |
{ |