Skip to content

Instantly share code, notes, and snippets.

View amcdnl's full-sized avatar

Austin amcdnl

View GitHub Profile
@amcdnl
amcdnl / timeago_globalize.md
Created October 4, 2012 20:01
Date/Time Ago + jQuery Globalize

Date/Time Ago + jQuery Globalize

Formats Date/Time stamps to be relative using jQuery Globalize framework.

The following DOM would result in a relative time formatted string:

<span class="timeago" data-time="1349381619452"></span>

We extend the Globalize code to add this timeago helper.

@amcdnl
amcdnl / canjs_org.md
Created October 17, 2012 02:11
CanJS Project Organization

CanJS Project Organization

The CanJS project is growing rapidly. We need to make sure its easy to know what's what as it grows. We need to come up with a organization plan.

I'd like to get more users using the source code rather than downloading. It makes it easier for them to make commits, etc. But at the moment, its difficult for even me to sort out whats going on. We need to make it easy for users to find demos, docs, and tests.

If we structure it like this, we can even make the download cleaner where users can just download the code w/o all the demos and whatnot for more advanced users like us.

I feel like we should structure each module like control or model in a structure like the following:

@amcdnl
amcdnl / jq_html5.md
Created October 17, 2012 16:18
The jQuery for Next Generation of the Web

The jQuery for Next Generation of the Web

Soon jQuery will simply be a facade layer. With browser iterations becoming faster and faster, the web will soon loose the need for a jQuery.

The problem we face now is a similar problem we faced 5 years ago. Browser feature compatibility.

My idea is to take jQuery's syntax and paradigm and apply it to HTML5 and the next generation of web development.

Examples

@amcdnl
amcdnl / local_store_model.md
Created October 22, 2012 14:14
CanJS LocalStore Model

CanJS LocalStore Model

Implementation of locale store for CanJS.

steal('can/model', 'jquery/lang/object', function(){

can.Model('can.Model.Local',{

	compare : {},
@amcdnl
amcdnl / opt_tech.md
Created November 8, 2012 20:41
Optimization Techniques

Optimization Techniques

  • length > 0 to just length
  • Chaining rather than declaring variables
@amcdnl
amcdnl / can-notify.md
Created December 5, 2012 20:41
CanJS Notification System

CanJS Notification System

This widget creates a growl-like notification on a website using CanJS framework.

JavaScript

steal('can/construct',
	  'can/construct/super',
	  'can/construct/proxy',

'can/control',

@amcdnl
amcdnl / organizing.md
Last active December 10, 2015 08:28
Organizing a one-page JavaScript Application

Organizing a one-page JavaScript Application

Why Important

Imagine your body with no bones not organized in any shape or fashion. You would be a pile of mush with a bunch of spikes sticking out in random places.

Now imagine if those bones were all in the same place. You'd be a stick.

Organizing your application is important because:

Global Method Invoking

Sometimes you need the ability to call a globalish method from somewhere deep in your code. You have a few different options:

  • Expose a global method
  • Trigger an event on the DOM and the parent listens for it
  • Pass a instance of whatever into the child and call it from where

While each of these ways will accomplish the goal, they aren't that clean.

Upgrade your JMVC to CanJS/JMVC 3.3

A informal guide to things that have changed over the past versions and how you can get your project up to snuff.

New

These aren't necessarily new features but things were there in some capacity before but expanded upon in latest.

  • Model.List is now available for Observes
  • You can call methods directly from templated bindings. F example: "resize":function() { this.updateUI() }); could now be just "resize": "updateUI"
  • instances() and instance() can be called on observes.

Automatic Markdown Converter for Steal

Automatically converts markdown files to HTML with Steal and Showdown

window.docee = {
	markdown: {}
};

steal.type("md text", function( options, success, error ) { 

var converter = new Showdown.converter();