Skip to content

Instantly share code, notes, and snippets.

View justinbmeyer's full-sized avatar

Justin Meyer justinbmeyer

View GitHub Profile
@justinbmeyer
justinbmeyer / my
Created September 7, 2011 23:12
my$
<html>
<head>
</head>
<body>
<ul>
<li><a href='#lobsterroll'>Lobster Roll</a></li>
<li><a href='#cookies'>Cookies</a></li>
<li><a href='#crab'>Crab</a></li>
</ul>
<div id='lobsterroll'>
@justinbmeyer
justinbmeyer / thingsaboutjmvc.md
Created October 3, 2011 06:02
Things you might not know about JavaScriptMVC
  1. You can use every part on its own via the download builder.

  2. It's core MVC components are only 7k minified and gzipped.

  3. You can make changes and just refresh your browser. But for production, you can build all your files into a single script.

  4. FuncUnit can simulate complex user actions and run your tests in Selenium or PhantomJS.

  5. It's MIT licensed, 3 years old and maintained by Jupiter Consulting and several contributors.

@justinbmeyer
justinbmeyer / deferreds.md
Created October 11, 2011 22:14
Deferreds and 3.1

3.1 Backlog - Deferreds

jQuery 1.6 brought Deferred support. They are a great feature that promise to make a lot of asynchronous functionality easier to write and manage. But, many people struggle with uses other than 'waiting for a bunch of Ajax requests to complete'. For 3.1, we identified an extremely common, but annoying, practice that becomes a one-liner with deferreds: loading data and a template and rendering the result into an element.

@justinbmeyer
justinbmeyer / JavaScriptMVC_3-2.md
Created October 11, 2011 22:58
JavaScriptMVC 3.2

Features

steal

Most of the work for the new release has been around a new version of steal. We've re-worked steal from the ground up to:

  • Simplify the API
  • Make loading faster, but still work with any script.
  • Enable 'on-demand' loading
@justinbmeyer
justinbmeyer / closureaccess.md
Created October 14, 2011 04:20
What I would like

Background

Controller is really an event manager, it lets you listen to objects and when destroyed, automatically unbinds all event handlers.

It lets you listen to events on objects in the window like:

  Foo.Bar = new SomethingThatMakesEvents();

 $.Controller('FooListener',{
@justinbmeyer
justinbmeyer / TemplatedEventBinding.md
Created October 17, 2011 18:47 — forked from jupiterjs/TemplatedEventBinding.md
Templated Event Binding

3.2's $.Controller - Templated Event Binding Goodness

JavaScriptMVC 3.2 brings a lot of great features and enhancements. So many features that changes to $.Controller didn't make the cut for our upcoming 3.2 article. This article reviews 3.2's $.Controller and talks about templated event binding (something we neglected to write up for 3.1).

Bind and Memory Leaks

Neglecting to unbind event handlers is the easiest way to create memory leaks. This is extremely common in an MVC architecture as you constantly listen for model changes:

Task.bind('created', function(ev, newTask){

// add task to list

@justinbmeyer
justinbmeyer / TemplatedEventBinding.md
Created October 18, 2011 06:21 — forked from moschel/TemplatedEventBinding.md
Templated Event Binding

3.2's $.Controller - Templated Event Binding Goodness

JavaScriptMVC 3.2 brings a lot of great features and enhancements. So many features that changes to $.Controller didn't make the cut for our upcoming 3.2 article. This article reviews 3.2's $.Controller and talks about templated event binding (something we neglected to write up for 3.1).

Bind and Memory Leaks

Neglecting to unbind event handlers is the easiest way to create memory leaks. This is extremely common in an MVC architecture as you constantly listen for model changes:

Task.bind('created', function(ev, newTask){

// add task to list

@justinbmeyer
justinbmeyer / 3.x.md
Created October 18, 2011 19:46
JavaScriptMVC 3.X Video

Outline

  • highlight download builder
  • create an indexable app
    • use coffee, less?
    • testing
    • routing
@justinbmeyer
justinbmeyer / comparison.md
Created October 27, 2011 07:13
regexps are slow

For DocumentJS, I'm trying to quickly get line numbers from a file given a character position. For a given source, my character position would always increase. So I wanted to call it like:

var getLine = lineNumber("BIG SOURCE\n...");

getLine(54)   //->2
getLine(3453) //->55

I created 2 different ways of doing it.

@justinbmeyer
justinbmeyer / JS100.md
Created November 19, 2011 00:13
What you must know about JavaScript

Dynamic Scripting

Code in languages like Java or C is compiled to byte or machine code. When your app runs, it's taking instructions from code and operating on data.

Dynamic Languages, like JavaScript are rather different. Instead of a strong separation between code and data, your application is built one statement at a time. You are effectively programming your program.

For example, what happens when a script tag like <script type='text/javascript' src='myapp.js'></script> loads the following code?

var JS = {};