Skip to content

Instantly share code, notes, and snippets.

@dj-amadeous
dj-amadeous / index.html
Created July 14, 2017 22:33
webgl mat4.perspective function nonsense
function drawScene() {
gl.viewport(0, 0, gl.viewportWidth, gl.viewportHeight);
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
mat4.perspective(45, gl.viewportWidth / gl.viewportHeight, 0.1, 100.0, pMatrix);
mat4.identity(mvMatrix);
mat4.translate(mvMatrix, [-1.5, 0.0, -7.0]);
gl.bindBuffer(gl.ARRAY_BUFFER, triangleVertexPositionBuffer);
@dj-amadeous
dj-amadeous / example.js
Created July 5, 2017 20:47
sigma basic example
/**
* This is a basic example on how to instantiate sigma. A random graph is
* generated and stored in the "graph" variable, and then sigma is instantiated
* directly with the graph.
*
* The simple instance of sigma is enough to make it render the graph on the on
* the screen, since the graph is given directly to the constructor.
*/
var i,
s,
free(*(firstDblPtr + *numStudents - 1));
free(*(lastDblPtr + *numStudents - 1));
free(*(scoreDblPtr + *numStudents - 1));
firstDblPtr = realloc(firstDblPtr, (*numStudents - 1) * sizeof(char*));
lastDblPtr = realloc(lastDblPtr, (*numStudents - 1) * sizeof(char*));
scoreDblPtr = realloc(scoreDblPtr, (*numStudents - 1) * sizeof(double*));
function destroyer(arr) {
// Remove all the values
var array2 = Array.from(arguments).slice(1);
return arr.filter(function(val){
return !array2.includes(val);
});
}
destroyer([1, 2, 3, 1, 2, 3], 2, 3);
function palindrome(str) {
// Good luck!
newStr = str.replace(/[^A-Za-z]+/, '');
console.log(newStr);
return true;
}
palindrome("eye1111%%");
//Setup
var contacts = [
{
"firstName": "Akira",
"lastName": "Laine",
"number": "0543236543",
"likes": ["Pizza", "Coding", "Brownie Points"]
},
{
//Setup
var contacts = [
{
"firstName": "Akira",
"lastName": "Laine",
"number": "0543236543",
"likes": ["Pizza", "Coding", "Brownie Points"]
},
{
//Setup
var contacts = [
{
"firstName": "Akira",
"lastName": "Laine",
"number": "0543236543",
"likes": ["Pizza", "Coding", "Brownie Points"]
},
{
public static void mergeSort_srt(int array[], int lo, int n) {
int low = lo;
int high = n;
if (low >= high) {
return;
}
@dj-amadeous
dj-amadeous / Lab4Part1a.java(second try)
Created October 23, 2016 03:09
comparing line 5 with method
else if ((yearDiff > 0) && (monthValid)) // Year2 is after Year 1
{
System.out.println();
daysBetween = daysToEndOfMonth(dd1,mm1);
daysBetween = daysOfMonth(daysBetween,mm1+1,12+1);
daysBetween = daysOfMonth(daysBetween,1,mm2);
daysBetween += dd2;
daysBetween += ((yearDiff-1)*365);// *-* add in 365 days for each year inbetween yyyy1 and yyyy2
}