Skip to content

Instantly share code, notes, and snippets.

View omniosi's full-sized avatar

Ornette Coleman omniosi

View GitHub Profile
@omniosi
omniosi / cross-browser-width-height
Created April 28, 2014 15:35
cross browser code to get the browser window width and height
var w = window,
d = document,
e = d.documentElement,
g = d.getElementsByTagName('body')[0],
x = w.innerWidth || e.clientWidth || g.clientWidth,
y = w.innerHeight|| e.clientHeight|| g.clientHeight;
console.log("browser width = "+x);
console.log("browser height = "+y);
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, maximum-scale=1.0, target-densityDpi=device-dpi">
@omniosi
omniosi / jsbin.sunip.html
Created April 11, 2014 19:19
pointer events code by @girlie_mac as seen in netm.ag may 2014
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<script>
var isTouchSupported = 'ontouchstart' in window;
@omniosi
omniosi / jsbin.ciweb.html
Created March 14, 2014 20:27
using RaphaelJS to animate a circle path into a custom shape path. inlcudes a function to convert a RaphaelJS circle shape to a path (a cleaned up version of this code: https://groups.google.com/forum/#!topic/raphaeljs/6gH8TiOWlAw)
<!DOCTYPE html>
<html>
<head>
<style>
#box{
width:300px;
height:250px;
background: lightblue;
border:1px solid black;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin - rAF test</title>
<style>
#elm{
background: lightblue;
width: 20px;
height: 20px;
@omniosi
omniosi / jsbin.yibiz.html
Created March 6, 2014 22:14
create randomly positioned copies of an object
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
<style>
#box{
width:300px;
height:250px;
background: lightblue;
@omniosi
omniosi / generate_random-number
Created March 6, 2014 22:09
a function to generate a random number with a minimum and a maximum
// Returns a random integer between min and max
// Using Math.round() will give you a non-uniform distribution!
function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
@omniosi
omniosi / flash_generated_raindrops
Created March 6, 2014 19:46
code to duplicate and animate a movie clip. raindrops in this example
for (i=0; i<300; i++) {
duplicateMovieClip("drop", "drop"+i, i);
setProperty("drop"+i, _alpha, random(50));
i++;
}
@omniosi
omniosi / jsbin.nerey.html
Created March 4, 2014 17:11
simple banner animation with RaphaelJS. not realistic as RaphaelJS library is 91K at its smallest and iab banner size spec is 40K
<!DOCTYPE html>
<html>
<head>
<script src="http://cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<div id="box"></div>
</body>
@omniosi
omniosi / jsbin.xamak.html
Created March 3, 2014 20:38
updated RaphaelJS interactive arm animation
<!DOCTYPE html>
<html>
<head>
<script src="http://cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<div id="box"></div>
</body>