Skip to content

Instantly share code, notes, and snippets.

View pchinjr's full-sized avatar
🙏
Building the best tools to #praisecage

Paul Chin Jr. pchinjr

🙏
Building the best tools to #praisecage
View GitHub Profile
@pchinjr
pchinjr / recordupdate.js
Last active January 3, 2016 19:16
waypoint: reccord collection
// Setup
var collection = {
2548: {
album: "Slippery When Wet",
artist: "Bon Jovi",
tracks: [
"Let It Rock",
"You Give Love a Bad Name"
]
},
@pchinjr
pchinjr / server.js
Last active February 13, 2018 17:23
expressjs example
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'));
//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')
})
});
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);
try {
myLove()
}
catch(feelings) {
console.log('oh no')
}
# example .arc file
@app
test-app
@http
get / # home route
get /login # login route
get /logout # logout route
@tables
// 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">
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
@pchinjr
pchinjr / index.ts
Created May 26, 2020 04:59
deno 1.0 command line test
//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'");
@pchinjr
pchinjr / index.js
Created August 7, 2020 23:53
Serverless Architect Hello World - illustrates an AWS Lambda Function in Architect for an HTTP GET Request
// /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>'
}
}