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
// Two lines defined by entering 2 points | |
var line1 = new line([1, 1], [5, 5]); // Positive slope | |
var line2 = new line([1, 5], [5, 1]); // Negative slope | |
var line3 = new line([2, 6], [6, 2]); // Parallel to line 2 but line3 != line2 | |
var line4 = new line([3.5, 0], [3.5, 5]); // Vertical line | |
console.log(line1); | |
console.log(line2); | |
console.log("Calculate: ") | |
console.log(calcIntersection(line1, line2)); // returns (3,3) |
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
// Math.js by Sunmock Yang | |
function Vector(x, y){ | |
this.x = (typeof x !== "undefined") ? x : 0; | |
this.y = (typeof y !== "undefined") ? y : 0; | |
} | |
Vector.prototype.set = function(x,y) { | |
this.x = x; this.y = y; | |
}; |
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
<html> | |
<head> | |
<meta content="text/html;charset=utf-8" http-equiv="Content-Type"> | |
<meta content="utf-8" http-equiv="encoding"> | |
<style type="text/css"> | |
#canvas{ | |
border: gray solid 2px; | |
} | |
</style> | |
</head> |
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
#!/bin/bash | |
# Nautilus script -> Puush File for Ubuntu/linux | |
# Owner : Sunmock Yang | |
# www.sunmock.com | |
# May 2014 | |
# | |
# Dependencies: - puush-linux (https://github.com/blha303/puush-linux) | |
# - xclip | |
# - notify-send | |
# - Nautilus |
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
#!/bin/bash | |
MAX_WIDTH=1280 | |
MAX_HEIGHT=720 | |
OUTPUT_DIR=${HOME}"/Videos" | |
IPHONE_PRESET="-e x264 -q 20.0 -r 30\ | |
--pfr -a 1 -E ffaac -B 160 -6 dpl2 -R Auto\ | |
-D 0.0 --audio-copy-mask aac,ac3,dtshd,dts,mp3\ |
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
var Class = (function(){ | |
var Class, | |
staticVars = ""; | |
function exports(args){ | |
return new Class(args); | |
}; | |
Class = function(args){ | |
// Constructor |
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
<!DOCTYPE html> | |
<meta charset="utf-8" /> | |
<html> | |
<head> | |
<title>Project Template - Sunmock Yang</title> | |
<link rel="stylesheet" type="text/css" href="theme.css"> | |
</head> | |
<body> |
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
<!DOCTYPE html> | |
<meta charset="utf-8" /> | |
<html> | |
<head> | |
<title>Project Template - Sunmock Yang</title> | |
<link rel="stylesheet" type="text/css" href="theme.css"> | |
</head> | |
<body> |
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
function Bounds(top, left, width, height){ | |
this.top = (top) ? top : 0; | |
this.left = (left) ? left : 0; | |
this.width = (width) ? width : 0; | |
this.height = (height) ? height : 0; | |
this.right = this.left + this.width; | |
this.bottom = this.top + this.height; | |
}; |
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: new ColorAnimator(document.getElementById("elem"), "backgroundColor", ["#FF0063", "#63FF00"], "slow"); | |
function ColorAnimator(element, styleAttribute, colors, speed){ | |
this.element = element; | |
this.styleAttribute = styleAttribute; | |
this.colors = []; | |
for (var i = 0; i < colors.length; i++) { | |
this.colors.push(new ColorAnimator.Color(colors[i])); |
OlderNewer