Skip to content

Instantly share code, notes, and snippets.

View limzykenneth's full-sized avatar

Kenneth Lim limzykenneth

View GitHub Profile
@limzykenneth
limzykenneth / test-class.js
Last active February 5, 2024 22:21
p5.js JSDoc Tests
/**
* @module Rendering
* @requires constants
*/
/**
* An object that one can draw to and then read as a texture. While similar
* to a p5.Graphics, using a p5.Framebuffer as a texture will generally run
* much faster, as it lives within the same WebGL context as the canvas it
* is created on. It only works in WebGL mode.
*
/**
* Create HTTP server.
*/
let server;
if(process.env.NODE_ENV !== "production"){
const https = require("https");
const httpsOptions = {
key: fs.readFileSync(path.join(__dirname, "../cert/private.key")),
cert: fs.readFileSync(path.join(__dirname, "../cert/public.crt"))
@limzykenneth
limzykenneth / sketch.js
Created May 8, 2020 13:43
p5.js Example rotationX/Y/Z with Permission
let canvas;
function setup() {
canvas = createCanvas(400, 400);
canvas.mouseClicked(function(){
// Detect if DeviceOrientationEvent.requestPermission is implemented
if (typeof DeviceOrientationEvent.requestPermission === "function"){
// If it is go ahead and call it. It returns a promise.
DeviceOrientationEvent.requestPermission().then(permissionState => {
@limzykenneth
limzykenneth / sketch.js
Last active May 7, 2020 22:09
p5.js Example Using RotationX/Y/Z
function setup() {
createCanvas(400, 400);
}
function draw() {
background(220);
textSize(30);
text("Rotation X: " + rotationX, 10, 40);
text("Rotation Y: " + rotationY, 10, 80);
text("Rotation Z: " + rotationZ, 10, 120);
{
"<start>": "<menu-items>",
"<menu-items>": ["<batter> fish", "<batter> chips", "curry chips", "fried chicken", "<batter> cod", "<batter> haddock", "<batter> plaice", "<batter> skate", "fish cake", "<batter> scampi", "fish fingers", "nuggets", "<big> <batter> <vege> saussage", "<big> <batter> saveloy", "<batter> roe", "<batter> onion rings", "beef burger", "cheeseburger", "chicken burger", "<vege> burger","jacket potato", "<pie-ingredient> pie", "<condiments>", "<mush> peas", "coleslaw", "gravy", "pickled <pickling>", "brown sauce", "<drink>", "<punctuation>"],
"<drink>": ["coke", "orange pop", "irn-bru", "lemonade", "<salad-type> salad"],
"<kebab>": [],
"<salad-type>": ["greek", "prawn", "mixed"],
"<pie-ingredient>": ["steak & kidney", "chicken & mushroom", "beef & onion"],
"<condiments>": ["vinegar", "mayonaise", "ketchup"],
"<batter>": ["", "", "", "", "battered"],
"<mush>": ["", "mushy"],
#include <iostream>
#include <math.h>
#include <stdint.h>
#include <random>
#include <chrono>
#include <stdlib.h>
using namespace std;
uint64_t gcd(uint64_t a, uint64_t b);
@limzykenneth
limzykenneth / vertigo-harmonograph.js
Created February 16, 2017 07:53
Vertigo poster graphics generator written in p5.js. Translated to p5.js from https://www.johndcook.com/blog/2017/02/14/recreating-the-vertigo-poster/
// Stop after how many frames
var iterations = 4000;
// The higher the damping the less the pendulum will shift its position
// ie. damping of 1000 or more will just draw concentric spirals
var damping = 400;
function setup() {
// Create canvas
var canvas = createCanvas(500, 500);
// Give canvas an id in order to style it with CSS later

Deploy your site with git securely

This gist assumes:

  • you have a local git repo
  • you have an online remote repository (github)
  • you have a server running Apache with git already installed

you should be able to do the same with Java, Perl, RoR, JSP etc. however you'll need to recreate the (rather simple) PHP script