This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ** | |
* | |
* 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 | |
* | |
* */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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..."); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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/ | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" make Vim more useful | |
set nocompatible | |
" vundle | |
filetype off | |
set rtp+=~/.vim/bundle/vundle/ | |
call vundle#rc() | |
" VUNDLES |
OlderNewer