Skip to content

Instantly share code, notes, and snippets.

@daffl
daffl / dform.html
Created August 5, 2011 02:51
Simple complete jQuery dform example
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title> KISS, based on fiddle example </title>
<script type='text/javascript' src='jquery-1.5.2.js'></script>
<script type="text/javascript" src="jquery-ui.js"></script>
<script type='text/javascript' src="jquery.dform-0.1.3.min.js"></
script>
@daffl
daffl / default
Created November 29, 2012 20:00
Apache default configuration
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/frontend
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/frontend>
Options Indexes FollowSymLinks MultiViews

CanJS and Backbone both provide structure for JavaScript applications through an MVC-like pattern.

CanJS

CanJS is a lightweight MVC framework built to provide structure for JavaScript applications. It is aimed at developers of any library who need a battle-hardened library that makes building complex applications easy. It is part of a larger offering named JavaScriptMVC from Bitovi (its creators) that has documentation, testing and dependency management tools.

Backbone

Backbone is a flexible, minimalist solution for seperating concerns in a JavaScript application. It provides just a little bit of structure to a jQuery application and has largely attracted developers who know just enough jQuery to get by and now want to organize their code a bit more.

@daffl
daffl / can.observe.attributes.js
Created March 26, 2013 14:34
Attributes plugin with recursive call fix
/*!
* CanJS - 1.1.5 (2013-03-26)
* http://canjs.us/
* Copyright (c) 2013 Bitovi
* Licensed MIT
*/
(function (can, window, undefined) {
// ## can/observe/attributes/attributes.js
can.each([can.Observe, can.Model], function (clss) {
// in some cases model might not be defined quite yet.
@daffl
daffl / browserstack
Created March 29, 2013 15:54
A small snippet to easily set up a BrowserStack local testing tunnell on the command line.
#!/bin/sh
PORT=$1
SSH=$2
if [ -z "$PORT" ]
then
PORT="80"
fi
@daffl
daffl / uglify.js
Last active March 17, 2021 20:09
Use UglifyJS 2 (uglify-js package) to compress a string of JavaScript source code
var UglifyJS = require('uglify-js');
module.exports = function(code) {
var toplevel = UglifyJS.parse(code);
toplevel.figure_out_scope();
var compressor = UglifyJS.Compressor({
warnings: false
});
@daffl
daffl / rapidstart.js
Last active December 23, 2015 13:49
Feathers rapid start example
var feathers = require('feathers');
var bodyParser = require('body-parser');
var todoService = {
todos: [],
// Return all todos from this service
find: function(params, callback) {
callback(null, this.todos);
},
@daffl
daffl / rest.js
Last active December 23, 2015 13:49
Feathers rapid start example results
// POST http://localhost:8000/todos
{
"description": "You have to do dishes!"
}
// GET http://localhost:8000/todos
[
@daffl
daffl / app.js
Last active May 17, 2016 20:39
Feathers real-time todos
var feathers = require('feathers');
var bodyParser = require('body-parser');
// An in-memory service implementation
var memory = require('feathers-memory');
// Create an in-memory CRUD service for our Todos
var todoService = memory();
var app = feathers()
// Set up REST and SocketIO APIs
.configure(feathers.rest())
@daffl
daffl / index.html
Created September 30, 2013 02:00
A Phonegap Hello world chat and image posting example using Twitter Bootstrap and jQuery
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Phonegap hello world</title>
<link rel="stylesheet" type="text/css" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" />
</head>
<body style="padding: 20px;">
<div class="container">
<div class="row">