Skip to content

Instantly share code, notes, and snippets.

@coryk135
coryk135 / Vector2D.js
Created July 23, 2018 02:41
JavaScript 2D Vector Class
/*
Simple 2D JavaScript Vector Class
Hacked from evanw's lightgl.js
https://github.com/evanw/lightgl.js/blob/master/src/vector.js
*/
function Vector(x, y) {
@coryk135
coryk135 / git-recursive.sh
Created September 21, 2017 20:59
git-recursive.sh
git-recursive () {
find . -name .git -type d -execdir printf "\033[0;34m" \; -execdir pwd \; -execdir printf "\033[0m" \; -execdir git "$@" \; -execdir echo "" \;
}
alias grc="git-recursive"
@coryk135
coryk135 / Particles.js
Last active December 2, 2015 02:08
Particle simulation
var l = document.body.children.length
for(var i = 0; i < l; i++){ document.body.children[0].remove() }
var c = document.createElement("canvas")
c.width = 400;
c.height = 400;
c.style.width = "800px"
c.style.height = "800px"
document.body.appendChild(c)
var style = document.createElement('style')
@coryk135
coryk135 / gameboy_irl_emulator.js
Last active August 29, 2015 14:24
Real life gameboy emulator
function init(){
var emulator = document.querySelector('#emulator_target')
emulator.style.top = "71px";
emulator.style.left = "166px";
emulator.style.width = "240px";
emulator.style.height = "160px";
emulator.style.opacity = "0.3";
emulator.style.zIndex = "200";
var gameboy = new Image()
@coryk135
coryk135 / index.html
Created June 30, 2015 20:24
Firebase realtime chat
<!doctype html>
<html>
<head>
<script src='https://cdn.firebase.com/v0/firebase-debug.js'></script>
<script src='https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js'></script>
<link rel='stylesheet' type='text/css' href='/resources/tutorial/css/example.css'>
</head>
<body>
<div id='messagesDiv'></div>
<div id='temp'></div>
@coryk135
coryk135 / modified_lights_out.html
Created December 23, 2014 17:26
Modified Lights Out
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
* {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
@coryk135
coryk135 / glass.html
Last active August 29, 2015 14:10
[wearscript] Key Input
<html>
<head>
<!-- You can include external scripts here like so... -->
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/zepto/1.0/zepto.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js"></script>-->
<style>
html, body { width: 100%; height 100%; overflow: hidden; margin: 0; background-color: black; }
</style>
</head>
<body>
@coryk135
coryk135 / glass.html
Last active August 29, 2015 14:10
[wearscript] RevealJS
<html>
<head>
<!-- You can include external scripts here like so... -->
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/zepto/1.0/zepto.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js"></script>-->
<link rel="stylesheet" href="https://rawgit.com/hakimel/reveal.js/master/css/reveal.css">
<link rel="stylesheet" href="https://rawgit.com/hakimel/reveal.js/master/css/theme/default.css">
<style>
html, body {
/*width: 100%; height 100%; overflow: hidden; margin: 0;*/
@coryk135
coryk135 / glass.html
Created December 2, 2014 16:19
[wearscript] WearScript Template
<html>
<head>
<!-- You can include external scripts here like so... -->
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/zepto/1.0/zepto.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js"></script>-->
<style>
html, body { width: 100%; height 100%; overflow: hidden; margin: 0; background-color: black; }
</style>
</head>
<body>
@coryk135
coryk135 / branch.js
Created November 20, 2014 18:49
Fibonacci Trees
function Branch(type, depth){
this.branches = [];
this.type = type || 0; // 1 or 0
this.depth = depth || 0;
}
Branch.prototype.grow = function(){
if(this.branches.length == 0){
if(this.type){
this.branches.push(new Branch(0, this.depth+1));
}