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
// Setup | |
var collection = { | |
2548: { | |
album: "Slippery When Wet", | |
artist: "Bon Jovi", | |
tracks: [ | |
"Let It Rock", | |
"You Give Love a Bad Name" | |
] | |
}, |
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 express = require('express'); | |
const app = express(); | |
const server = require("http").createServer(app); | |
const port = 3000; | |
server.listen(port); | |
console.log(`Server listening at http://localhost: ${port}`); | |
app.use(express.static(__dirname + '/public')); | |
app.get('/', (req, res) => res.sendFile(__dirname + '/public/index.html')); |
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
//Server Side Code | |
const io = require('socket.io')(server); | |
io.on('connection', function(socket) { | |
console.log('Your socket id is', socket.id); | |
socket.on('eventName', function doSomething() { | |
console.log('executing doSomething') | |
}) | |
}); |
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 RollingSpider = require('rolling-spider'); | |
const rollingSpider = new RollingSpider(); | |
rollingSpider.connect( function() { | |
rollingSpider.setup( function () { | |
rollingSpider.flatTrim(); | |
rollingSpider.startPing(); | |
rollingSpider.flatTrim(); | |
console.log('Connected to drone ', rollingSpider.name); | |
console.log(rollingSpider.status); |
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
try { | |
myLove() | |
} | |
catch(feelings) { | |
console.log('oh no') | |
} |
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
# example .arc file | |
@app | |
test-app | |
@http | |
get / # home route | |
get /login # login route | |
get /logout # logout route | |
@tables |
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
// learn more about HTTP functions here: https://arc.codes/primitives/http | |
exports.handler = async function http (req) { | |
return { | |
headers: {'content-type': 'text/html; charset=utf8'}, | |
body: ` | |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> |
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
export function quote() { | |
let quotes = [ | |
"It's a family that's loaded with grudges and passion. We come from a long line of robbers and highwaymen in Italy, you know. Killers, even.", | |
"To be a good actor you have to be something like a criminal, to be willing to break the rules to strive for something new.", | |
"I think I jump around more when I'm alone.", | |
"I bought a Yamaha-1 and I was doing 180 miles per hour home on the 405 and that's really, really crazy but I did it.", | |
"I believe that being successful means having a balance of success stories across the many areas of your life. You can't truly be considered successful in your business life if your home life is in shambles.", | |
"I always say to myself that if I can make a movie that makes a kid smile or gives them some hope or something to get excited about, then I'm applying myself in the best way that I can. I don't think that just goes for kids. I think that it goes for adults, as well, and for families.", | |
"Passion is very impo |
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
//https://www.youtube.com/watch?v=hVqNwrpCtm4 | |
import { parse } from "https://deno.land/std/flags/mod.ts"; | |
import { TextProtoReader } from "https://deno.land/std/textproto/mod.ts"; | |
import { BufReader } from "https://deno.land/std/io/bufio.ts"; | |
const parsedArgs = parse(Deno.args); | |
async function main() { | |
if (parsedArgs.h || parsedArgs.help || parsedArgs._.length === 0) { | |
console.log("try saying 'hi'"); |
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
// /project/path/src/http/get-index/index.js | |
exports.handler = async function http(request) { | |
return { | |
headers: {'content-type': 'text/html; charset=utf-8;'}, | |
body: '<h1>Hello World! 🎉</h1>' | |
} | |
} |
OlderNewer