Skip to content

Instantly share code, notes, and snippets.

Keith Rosenberg netpoetica

Block or report user

Report or block netpoetica

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@netpoetica
netpoetica / ImportSVGToSymbol.html
Created Jan 8, 2013
In Paper.js, use importSVG to import an svg node to a useable symbol and remove it from the DOM.
View ImportSVGToSymbol.html
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Paperjs - ImportSVG to Symbol</title>
<script type="text/javascript" src="js/lib/paper.js"></script>
<script type="text/paperscript" canvas="canvas">
function SVGSymbol(elem){
var a = new Symbol(paper.project.importSvg(elem));
elem.parentNode.removeChild(elem);
@netpoetica
netpoetica / Paperjs-ImportSVGFromFile.html
Created Jan 8, 2013
Using Paperjs and jQuery, import a .svg file as a symbol into a Paperjs project. Without having to append it to the DOM first and remove it, without having inline SVG.
View Paperjs-ImportSVGFromFile.html
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Paperjs - ImportSVG to Symbol</title>
<script type="text/javascript" src="js/lib/jquery-1.8.3.js"></script>
<script type="text/javascript" src="js/lib/paper.js"></script>
<script type="text/paperscript" canvas="canvas">
function SVGSymbol(file){
@netpoetica
netpoetica / GrokJSScope.js
Created Nov 1, 2012
Some simple examples to help grok scope in JS in terms of object literals, functions, prototypes and inheritance
View GrokJSScope.js
// Grok JS Scope for Object Literals in Various Uses
var name = 'Keith Window';
var obj = {
name: 'Keith Object',
getObjName: function(){
return this.name;
},
getWindowName: function(){
return name;
@netpoetica
netpoetica / MultipleInheritance.js
Created Oct 27, 2012
A useful example of prototypal multiple inheritance and how the Prototype chain works
View MultipleInheritance.js
// Useful example of inheritance. We will demonstrate multiple
// levels of inheritance here - objects inheriting from objects
// inheriting from objects :)
// Based on example I found here: http://atomicrobotdesign.com/blog/javascript/a-bit-more-on-javascript-prototypes/comment-page-1/#comment-83258
function Person(name, city, job) {
this.name = name;
this.city = city;
this.job = job;
}
Person.prototype = {
@netpoetica
netpoetica / assert.js
Created Sep 24, 2012
A visual and console implementation of a basic assert in JavaScript - assertions with a assertion panel in your browser window without intruding upon your other content.
View assert.js
/*
assert.js
by keith rosenberg / netpoetica
An assert function that will create a visual pane if browser is present. It will always
output to console as well. The styling is configured to be position-fixed to the top
right corner (hopefully in most situations, out of the way). I created this after viewing
http://net.tutsplus.com/tutorials/javascript-ajax/quick-tip-quick-and-easy-javascript-testing-with-assert/
@netpoetica
netpoetica / UnitTest.js
Created Sep 20, 2012
Unit Test functions for basic client-side unit testing (will add more as I use them in my code)
View UnitTest.js
/*
Name: UnitTest.js
Desc: Various unit testing functions. I use these for running quick tests
especially against JavaScript functions and variables, which are loosely type
and typically can behave unexpectedly
Location: https://dl.dropbox.com/u/30820392/JS_Utils/UnitTest.js
JavaScript Style Guide - Readable, Consistent Code
Yahoo, Google, Mozilla, jQuery recommendations
@netpoetica
netpoetica / utils.js
Created Sep 20, 2012
custom cross-browser getElementsByClassname and various utility functions
View utils.js
/*
Name: utils.js
Desc: A collection of JS Utility functions, some authored by me (Keith Rosenberg, http://www.keithrosenberg.com)
and some authored by fellow scripters
Location: https://dl.dropbox.com/u/30820392/JS_Utils/utils.js
JavaScript Style Guide - Readable, Consistent Code
Yahoo, Google, Mozilla, jQuery recommendations
Naming:
@netpoetica
netpoetica / Property.js
Created Aug 31, 2012
Properties (Getter and Setter accessible attributes) in JavaScript. An attempt to make variables with getters and settes in JavaScript easily. Basically, make them an object instead. Maybe useful to someone!
View Property.js
var Property = function(vari){
console.log("Creating a public accessor...");
this.vari = vari;
return function(){
if(arguments.length > 0){
console.log("Setting the variable to " + arguments[0] + "...");
vari = arguments[0];
return;
}
console.log("Getting the variable...");
@netpoetica
netpoetica / Singleton.js
Created Aug 20, 2012
A Singleton in JavaScript that truly ensures one instance, can be lazy-loaded (you can instantiate it whenever you need it), and has private and public scope.
View Singleton.js
/* **
*
* Singleton.js - a true Singleton in JavaScript
*
* A Singleton in JavaScript that truly ensures one instance, can be lazy loaded / you
* can instantiate it whenever you need it and has private and public scope.
*
* @author Keith Rosenberg, netPoetica
*
* */
You can’t perform that action at this time.