Skip to content

Instantly share code, notes, and snippets.

var chat = {
// Create this closure to contain the cached modules
module: function() {
// Internal module cache.
var modules = {};
// Create a new module reference scaffold or load an
// existing module.
return function(name) {
// If this module has already been created, return it.
@murindwaz
murindwaz / app.js
Created January 31, 2013 18:09 — forked from geekdave/app.js
var MyApp = {};
MyApp.Router = Backbone.Router.extend({
routes: {
// general routes for cross-app functionality
"" : "showGeneralHomepage",
"cart" : "showShoppingCart",
"account" : "showMyAccount",
// module-specific subroutes:
@murindwaz
murindwaz / app.js
Last active December 12, 2015 00:38 — forked from geekdave/app.js
var MyApp = {};
MyApp.Router = Backbone.Router.extend({
routes: {
// general routes for cross-app functionality
"" : "showGeneralHomepage",
"cart" : "showShoppingCart",
"account" : "showMyAccount",
// module-specific subroutes:
# All of your views should inherit from the BaseView. As a result you get the
# globalEvents functionality for free. The globalEvents hash is similar to that
# of the built-in Backbone events hash. It automatically binds event names to
# instance methods.
#
# class TestView extends ModularView
#
# globalEvents:
# "PhoneRang": "answerPhone"
#
//This is the Backbone controller that manages the content of the app
var Content = Backbone.View.extend({
initialize:function(options){
Backbone.history.on('route',function(source, path){
this.render(path);
}, this);
},
//This object defines the content for each of the routes in the application
content:{
"":_.template(document.getElementById("root").innerHTML),
/* The API controller
Exports 3 methods:
* post - Creates a new thread
* list - Returns a list of threads
* show - Displays a thread and its posts
*/
var Thread = require('../models/thread.js');
var Post = require('../models/post.js');
<?php
define('CONS_KEY', 'Application consumer key');
define('CONS_SECRET', 'Application consumer secret');
require_once __DIR__.'/silex.phar';
$app = new Silex\Application();
// register the session extension
$app->register(new Silex\Extension\SessionExtension());
<?php
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
require_once __DIR__.'/../vendor/autoload.php';
$app = new Silex\Application();
$app['debug'] = true;
var mysql = require('mysql');
var client = mysql.createConnection({
host: 'localhost',
user: 'omeka',
password: 'omeka',
port: 8889,
database: 'neatline'
});
var mysql = require('mysql');
var randy = require('randy');
var _ = require('underscore');
// Query base.
var sql = 'INSERT INTO omeka_neatline_records (' +
'exhibit_id,'+
'title,'+
'description,'+
'map_active,'+