Skip to content

Instantly share code, notes, and snippets.

View jonobr1's full-sized avatar
🐌
Petit à petit ça avance

Jono jonobr1

🐌
Petit à petit ça avance
View GitHub Profile
/* jquery.formUI by Jono Brandel
http://jonobr1.com/
This is an all purpose javascript file
to increase the usability for forms.
Dependent on jQuery.
http://jquery.com/
--------------------------------------------*/
$(function(){
@jonobr1
jonobr1 / pseudoTween.js
Created November 3, 2010 05:50
pseudo code for question on tween.js library. https://github.com/sole/tween.js/issues/issue/7
<html>
<script type = "text/javascript" src = "tween.js"></script>
<script>
var g, canvas;
var objects = [];
function init() {
canvas = document.createElement('canvas');
document.body.appendChild(canvas);
@jonobr1
jonobr1 / narcissus.html
Created November 24, 2010 19:18
Narcissus Background Application: This is port of Narcissus to the web built for HTML5 and dependent on mouse interaction, Processing.js and jQuery. 09 / 2010 Paste this right after the body tag in your html document to Narcissusify your page.
<script type = "text/javascript" src = "http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type = "text/javascript" src = "http://processingjs.org/content/download/processing-js-1.0.0/processing-1.0.0.min.js"></script>
<script type = "text/javascript" id = "narcissus_source">
function initNarcissus() {
if(!(window.jQuery && window.jQuery.fn.jquery == '1.3.2')) {
if(!document.getElementById('narcissus_jquery')) {
var jquery = document.createElement('script');
jquery.setAttribute('src', 'http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js');
jquery.setAttribute('type', 'text/javascript');
@jonobr1
jonobr1 / lineToVar.java
Created January 29, 2011 02:28
Line-to-Variables
String thisLine = reader.readLine();
if(thisLine != null) {
String[] explode = split(thisLine, '=');
if (explode != null) {
long epoch = explode[0].trim() / 1000;
Date time = new Date(epoch);
float lat = -1;
float lon = -1;
String[] latLong = split(explode[1].trim(), ',');
@jonobr1
jonobr1 / latLonToXY.as
Created February 12, 2011 00:25
Lat / Lon point's to X / Y algorithm's in actionscript, but easily portable
private function getPoint(lat : Number, lon : Number, mapwidth : uint, mapheight : uint) : Point
{
return new Point(((lon+180) / 360) * mapwidth, ((90-lat) / 180) * mapheight);
}
private function getMercatorPoint(lat : Number, lon : Number, mapwidth : uint, mapheight : uint) : Point
{
return new Point(((lon+180) / 360) * mapwidth, ((90-GudermannianInv(lat)) / 180) * mapheight);
}
@jonobr1
jonobr1 / _inTheHead.html
Created February 18, 2011 21:30
Snippet for Edward co. Eyebeam for DataViz Challenge embed of HTML5 canvas object.
<!-- Place anywhere in the head -->
<style type = "text/css">
canvas {
width: 100%;
height: 759px;
}
#example-vis {
position: absolute;
top: -250px;
@jonobr1
jonobr1 / supports_canvas.js
Created February 22, 2011 19:37
Check Canvas Support.
function supports_canvas() { return !!document.createElement('canvas').getContext; };
@jonobr1
jonobr1 / CMYK_RGB.js
Created November 19, 2011 03:15
An array of rgb array values from their CMYK counterpart.
/**
* @author jonobr1 / http://jonobr1.com
*
* An array of rgb values from their CMYK counterpart in Adobe Photoshop CS4. CMYK space is 0 - 10.
* e.g:
*
* CMYK_RGB[0] represents c: 0, m: 0, y: 0, k: 0
* CMYK_RGB[1] represents c: 0, m: 0, y: 0, k: 1
* CMYK_RGB[2] represents c: 0, m: 0, y: 0, k: 2
* CMYK_RGB[n] represents c: Math.floor(n / 30), (Math.floor(n / 20) % 10), y: (Math.floor(n / 10) % 10), k: (n % 10) ???
@jonobr1
jonobr1 / Superformula.js
Created February 23, 2012 17:00
@brysonian's Superformula in JavaScript
(function() {
var root = this;
var previousSuperformula = root.Superformula;
var NP = 360, phi = Math.PI * 2 / NP;
var Superformula = root.Superformula = function(m, n1, n2, n3) {
@jonobr1
jonobr1 / compile.js
Created October 4, 2012 22:52
Closure Compiler Node Module
/// # Google Closure Compiler Service #
/// https://github.com/weaver/scribbles/blob/master/node/google-closure/lib/closure.js
/// Compress javascript with Node.js using the Closure Compiler
/// Service.
/// Attempted update for Node.js v0.8
var sys = require('sys');
exports.compile = compile;