Skip to content

Instantly share code, notes, and snippets.

View rhulha's full-sized avatar

Raymond Hulha rhulha

View GitHub Profile
@rhulha
rhulha / ConvertPly2JS
Created January 27, 2013 16:42
Converts a PLY 3D Model to JavaScript notation that can be used with WebGL
public class ConvertPly2JS {
public static void main(String[] args) throws Exception {
BufferedReader fr = new BufferedReader(new FileReader("C:\\Raytemp\\asteroid.ply"));
String line;
ArrayList<String> vertices = new ArrayList<String>();
ArrayList<String> textureCoords = new ArrayList<String>();
ArrayList<String> normals = new ArrayList<String>();
ArrayList<String> vertexIndices = new ArrayList<String>();
@rhulha
rhulha / gist:4720712
Created February 6, 2013 06:08
NodeInverse
// CLASS
define(["glMatrix", "Spatial"], function(glmat, Spatial){
// a Node is a Spatial without Mesh data
function Node(child)
{
Spatial.call(this, false);
this.name ="";
this.type ="";
this.enabled = true;
@rhulha
rhulha / self-contained WebGL demo
Created May 27, 2013 10:17
self-contained WebGL demo
<html>
<head>
<title>WebGL</title>
</head>
<body marginheight="0" marginwidth="0" bgcolor="blue">
<canvas id="webgl-canvas" style="border: none; width:100%; height: 100%" width="100" height="100">
</canvas>
<script>
// 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:

@rhulha
rhulha / gist:92bee42c35c970cce761
Created February 12, 2015 02:20
Wunderlist completed task remover written in Dart
import 'dart:convert';
import 'package:http/http.dart' as http;
void main() {
var url = 'https://a.wunderlist.com/api/v1/';
var client_id = 'blabla';
var client = new http.Client();
client.post(url + "authenticate", body: {
"email": "bla@blabla.net",
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 {