Skip to content

Instantly share code, notes, and snippets.

var application_root = __dirname,
express = require("express"),
path = require("path"),
mongoose = require('mongoose');
var app = express.createServer();
// database
mongoose.connect('mongodb://localhost/ecomm_database');
@jamiefolsom
jamiefolsom / demo.htm
Created June 8, 2012 16:42 — forked from bennadel/demo.htm
Cross-Origin Resource Sharing (CORS) AJAX Requests Between jQuery And Node.js
<!DOCTYPE html>
<html>
<head>
<title>Cross-Origin Resource Sharing (CORS) With jQuery And Node.js</title>
</head>
<body>
<h1>
Cross-Origin Resource Sharing (CORS) With jQuery And Node.js
</h1>
@jamiefolsom
jamiefolsom / jquery.ba-tinypubsub.js
Created August 14, 2012 16:33 — forked from cowboy/HEY-YOU.md
jQuery Tiny Pub/Sub: A really, really, REALLY tiny pub/sub implementation for jQuery.
/* jQuery Tiny Pub/Sub - v0.7 - 10/27/2011
* http://benalman.com/
* Copyright (c) 2011 "Cowboy" Ben Alman; Licensed MIT, GPL */
(function($) {
var o = $({});
$.subscribe = function() {
o.on.apply(o, arguments);
jQuery(function ($) {
// Get a reference to the Annotator for event callback subscriptions //
var studio = $('#textcontent').annotator();
studio.annotator('addPlugin','Auth', {
token: '<%= @jwt %>'
});
studio.annotator('addPlugin','Store', {
prefix: 'http://localhost:5000/api',
@jamiefolsom
jamiefolsom / Store.coffee
Created September 5, 2012 17:24
Adding events to the Store plugin
# Public: Callback method for annotationCreated event. Receives an annotation
# and sends a POST request to the sever using the URI for the "create" action.
#
# annotation - An annotation Object that was created.
#
# Examples
#
# store.annotationCreated({text: "my new annotation comment"})
# # => Results in an HTTP POST request to the server containing the
# # annotation as serialised JSON.
@jamiefolsom
jamiefolsom / wp-config.php
Created September 14, 2012 21:19 — forked from micahwalter/wp-config.php
wp-config for mamp and phpfog
<?php
/**
* The base configurations of the WordPress.
*
* This file has the following configurations: MySQL settings, Table Prefix,
* Secret Keys, WordPress Language, and ABSPATH. You can find more information
* by visiting {@link http://codex.wordpress.org/Editing_wp-config.php Editing
* wp-config.php} Codex page. You can get the MySQL settings from your web host.
*
* This file is used by the wp-config.php creation script during the
@jamiefolsom
jamiefolsom / gist:4079751
Created November 15, 2012 16:56
Annotator Exception
n.prototype.setupAnnotation = function(t, n) {
var r, s, o, u, a, f, l, c, h;
n == null && (n = !0), u = this.wrapper[0], t.ranges || (t.ranges = this.selectedRanges), s = [], h = t.ranges;
for (a = 0, l = h.length; a < l; a++) {
o = h[a];
try {
s.push(i.sniff(o).normalize(u))
} catch (p) {
if (!(p instanceof i.RangeError))
throw p;
@jamiefolsom
jamiefolsom / gist:4079755
Created November 15, 2012 16:57
Annotation ranges
[ { "start" : "/div[1]/p[1]", "startOffset" : 25, "end" : "/div[1]/p[1]", "endOffset" : 38, "_id" : { "$oid" : "509a0bf6fdcc6c020000000f" } } ]
[ { "start" : "/div[1]/p[1]", "startOffset" : 40, "end" : "/div[1]/p[1]", "endOffset" : 51, "_id" : { "$oid" : "509a0ce5fdcc6c0200000011" } } ]
[ { "start" : "/div[1]/p[1]", "startOffset" : 55, "end" : "/div[1]/p[1]", "endOffset" : 69, "_id" : { "$oid" : "509a0e31fdcc6c0200000013" } } ]
[ { "start" : "/div[1]/p[20]", "startOffset" : 511, "end" : "/div[1]/p[20]", "endOffset" : 702, "_id" : { "$oid" : "509a0f6dfdcc6c0200000015" } } ]
[ { "start" : "/div[1]/p[11]", "startOffset" : 1059, "end" : "/div[1]/p[11]", "endOffset" : 1158, "_id" : { "$oid" : "509ecdfb23b58f0200000003" } } ]
[ { "start" : "/div[1]/p[12]", "startOffset" : 122, "end" : "/div[1]/p[12]", "endOffset" : 211, "_id" : { "$oid" : "509ecf1a23b58f0200000005" } } ]
[ { "start" : "/div[1]/p[12]", "startOffset" : 595, "end" : "/div[1]/p[12]", "endOffset" : 724, "_id" : { "$oid" : "509ecfb8d3ef590200000003" } }
@jamiefolsom
jamiefolsom / userAuthorize
Created November 27, 2012 19:24
userAuthorize
userAuthorize: function (action, annotation, user) {
console.info(action);
console.info(annotation);
console.info(user);
switch (action) {
case "read":
var overlap = _.intersection(user.groups,annotation.permissions.read);
if (overlap.length > 0) {
console.info(overlap);
return true;
cfrp_development=# select * from play_ticket_sales order by play_performance_id limit 50;
play_performance_id | seating_capacity | name | title | author | genre | date | total_sold
---------------------+------------------+--------------------+----------------------------------------+----------------------------------------------------------------------------------+----------------+------------+------------
114 | 6 | Premières Loges 1 | Chevalier à la mode (Le) | Dancourt (Florent Carton dit) | comédie | 1778-06-16 | 0
114 | 6 | Premières Loges 2 | Chevalier à la mode (Le) | Dancourt (Florent Carton dit) | comédie | 1778-06-16 | 0
114