Skip to content

Instantly share code, notes, and snippets.

View rhulha's full-sized avatar

Raymond Hulha rhulha

View GitHub Profile
// From Three.js
uniform float cameraNear;
uniform float cameraFar;
uniform float fogNear;
uniform float fogFar;
uniform bool fogEnabled;
uniform bool onlyAO;
uniform vec2 size;

Procedural content

If you use just procedural geometries and don't load any textures, webpages should work straight from the file system, just double-click on HTML file in a file manager and it should appear working in the browser (accessed as file:///example).

Content loaded from external files

If you load models or textures from external files, due to browsers' "same origin policy" security restrictions, loading from a file system will fail with a security exception.

There are two ways how to solve this:

100 Best First Lines from Novels
1. Call me Ishmael. —Herman Melville, Moby-Dick (1851)
2. It is a truth universally acknowledged, that a single man in possession of a good fortune, must be in want of a wife. —Jane Austen, Pride and Prejudice (1813)
3. A screaming comes across the sky. —Thomas Pynchon, Gravity's Rainbow (1973)
4. Many years later, as he faced the firing squad, Colonel Aureliano Buendía was to remember that distant afternoon when his father took him to discover ice. —Gabriel García Márquez, One Hundred Years of Solitude (1967; trans. Gregory Rabassa)
@rhulha
rhulha / JTDB_Tutorial1.java
Created June 4, 2015 16:25
JTDB Tutorial 1
import FairCom.CtreeDb.*;
import FairCom.CtreeDb.Types.*;
import java.io.*;
/**
*
* @author FairCom Corporation
*/
public class JTDB_Tutorial1 {
@rhulha
rhulha / MongoDB_Tutorial1.java
Created June 4, 2015 16:30
MongoDB Hello World
package com.mkyong.core;
import java.net.UnknownHostException;
import java.util.Date;
import com.mongodb.BasicDBObject;
import com.mongodb.DB;
import com.mongodb.DBCollection;
import com.mongodb.DBCursor;
import com.mongodb.MongoClient;
import com.mongodb.MongoException;
@rhulha
rhulha / SkypeChatLogParser.java
Created September 12, 2015 11:31
Skype chatlog parser using Java and SQLJet
import java.io.File;
import java.util.Calendar;
import org.tmatesoft.sqljet.core.SqlJetException;
import org.tmatesoft.sqljet.core.SqlJetTransactionMode;
import org.tmatesoft.sqljet.core.table.ISqlJetCursor;
import org.tmatesoft.sqljet.core.table.ISqlJetTable;
import org.tmatesoft.sqljet.core.table.SqlJetDb;
public class SkypeChatLogParser {
@rhulha
rhulha / deepCompare.java
Created October 5, 2015 18:26
Java deepCompare
public static boolean deepCompare(Object o1, Object o2) {
try {
ByteArrayOutputStream baos1 = new ByteArrayOutputStream();
ObjectOutputStream oos1 = new ObjectOutputStream(baos1);
oos1.writeObject(o1);
oos1.close();
ByteArrayOutputStream baos2 = new ByteArrayOutputStream();
ObjectOutputStream oos2 = new ObjectOutputStream(baos2);
oos2.writeObject(o2);
package net.raysforge.visual.demo;
import java.awt.Color;
import java.awt.Container;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
@rhulha
rhulha / TicTacToeOld.java
Last active November 6, 2015 21:23
Original starting code base from www3.ntu.edu.sg/home/ehchua/programming/java/javagame_tictactoe_ai.html
package net.raysforge.visual.demo;
import java.awt.Color;
import java.awt.Container;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
package net.raysforge.visual.demo;
import java.awt.Color;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;