Skip to content

Instantly share code, notes, and snippets.

function saveImage(canvasId) {
var canvas = document.getElementById(canvasId);
var dataUrl = canvas.toDataURL("image/png");
return dataUrl;
}
// example
// <canvas id="myCanvas" />
var imageUrl = saveImage('myCanvas');
class Animal
move: (x) -> @onMove x
onMove: (x) -> return
class Dog extends Animal
onMove: (x) -> # x is undefined
dog = new Dog()
dog.move 4
<link href="https://raw.github.com/jamesflorentino/nanoScrollerJS/master/bin/css/nanoscroller.css" rel="stylesheet" />
<link href="test.css" rel="stylesheet" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="https://raw.github.com/jamesflorentino/nanoScrollerJS/master/bin/javascripts/jquery.nanoscroller.min.js"></script>
<script src="test.js"></script>
<div id="bigText">
<div class="nano">
@jamesflorentino
jamesflorentino / BadScript.js
Created April 9, 2012 03:01 — forked from wilornel/BadScript
Big js script
var store_reguser;
function usernameVer(in_, out)
{
var ajaxRequest;
if (window.XMLHttpRequest)
{//Code for IE7+, Firefox, Chrome, Opera, Safari
ajaxRequest=new XMLHttpRequest();
}
else
@jamesflorentino
jamesflorentino / game-client-idea.coffee
Created June 8, 2012 08:02
Dynamic way of creating classes based on server response.
class GameModel
constructor: ->
classObjects = {}
@register = (name, classObject) -> classObjects[name] = classObject
@create = (name) -> new classObjects[name]
@ready()
ready: -> return
@jamesflorentino
jamesflorentino / HexTile.js
Created June 12, 2012 18:51
JavaScript code for finding the range of a HexTile in a hex-grid.
var HexTile;
HexTile = (function() {
function HexTile() {}
HexTile.WIDTH = 83;
HexTile.HEIGHT = 56;
<style>
@import "style.css";
</style>
<div>
<h1>Watch this carefully between hover states.</h1>
</div>
<style>
@import "style.css";
</style>
<div>
<h1>Watch this carefully between hover states.</h1>
</div>
@jamesflorentino
jamesflorentino / index.html
Created July 7, 2012 23:39
Hiding Texts in CSS
<style>
.logo {
background: url(https://a248.e.akamai.net/assets.github.com/images/modules/header/logo_gist.png?1315867479) top left no-repeat;
width: 655px;
height: 0;
overflow: hidden;
padding-top: 177px;
}
</style>
@jamesflorentino
jamesflorentino / index.html
Created July 9, 2012 01:06
Setting up nanoScroller as the entire gadget UI.
<link href="https://raw.github.com/jamesflorentino/nanoScrollerJS/master/bin/css/nanoscroller.css" rel="stylesheet"/>
<script src="https://raw.github.com/jamesflorentino/nanoScrollerJS/master/bin/javascripts/jquery.nanoscroller.min.js"></script>
<script>
<style>
body, html { height: 100%; font-size: 1em; font-family: Helvetica Neue, Helvetica, sans-serif ;}
#main { position: absolute; top: 0; right: 0; bottom: 0; left; 0; }
</style>
<script>