Skip to content

Instantly share code, notes, and snippets.

View nook-scheel's full-sized avatar

Nook Scheel nook-scheel

View GitHub Profile
@nook-scheel
nook-scheel / mixins.coffee
Created July 19, 2012 06:17
Using Ember.js Mixins
Lazier.CloseField = Ember.Mixin.create({
focusOut: ->
this.set('isEditing', false)
keyUp: (evt) ->
controller = Lazier.selectedProjectController
if evt.keyCode == 13
this.set('isEditing', false)
else
controller.content.set('isDirty', true)

Recently, we've been working on extracting Ember conventions from applications we're working on into the framework. Our goal is to make it clearer how the parts of an Ember application work together, and how to organize and bootstrap your objects.

Routing

Routing is an important part of web applications. It allows your users to share the URL they see in their browser, and have the same things appear when their friends click on the link.

The Ember.js ecosystem has several great solutions for routing. But, since it is such an important part of most web applications, we've decided to build it right into the framework.

If you have already modeled your application state using Ember.StateManager, there are a few changes you'll need to make to enable routing. Once you've made those changes, you'll notice the browser's address bar spring to life as you start using your app—just by moving between states, Ember.js will update the URL automatically.

@nook-scheel
nook-scheel / ember-precompile.js
Created May 11, 2012 12:44
Precompile .handlebars templates with node js
var fs = require('fs');
var vm = require('vm');
var emberjs = fs.readFileSync('public/javascripts/vendor/ember-0.9.5.min.js', 'utf8');
var templatesDir = 'templates';
var destinationDir = 'public/javascripts/templates';
function compileHandlebarsTemplate(templatesDir, fileName) {
var file = templatesDir + '/' + fileName;
@nook-scheel
nook-scheel / example.conf
Created April 2, 2012 08:43 — forked from cobbweb/example.conf
Nginx and PHP-FPM
server {
listen 8080;
server_name example.dev www.example.dev;
location / {
root /Users/Cobby/Sites/Example;
if ($host = 'www.example.dev' ) {
rewrite ^/(.*)$ http://example.dev:8080/$1 permanent;
}
@nook-scheel
nook-scheel / clean-use.php
Created December 12, 2011 07:24 — forked from ezzatron/clean-use.php
Script to clean unnecessary PHP use statements
#!/usr/bin/env php
<?php
$paths = array();
if (isset($_SERVER['argv']))
{
$paths = $_SERVER['argv'];
array_shift($paths);
if (!$paths)
Index: sapi/cli/config.w32
===================================================================
--- sapi/cli/config.w32 (revision 308839)
+++ sapi/cli/config.w32 (working copy)
@@ -6,7 +6,8 @@
ARG_ENABLE('cli-win32', 'Build console-less CLI version of PHP', 'no');
if (PHP_CLI == "yes") {
- SAPI('cli', 'php_cli.c', 'php.exe');
+ SAPI('cli', 'php_cli.c php_http_parser.c php_cli_server.c', 'php.exe');