Skip to content

Instantly share code, notes, and snippets.

@johnnncodes
johnnncodes / api.js
Created December 23, 2013 16:16 — forked from fwielstra/api.js
/* 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');
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "precise32"
config.vm.box_url = "http://files.vagrantup.com/precise32.box"
<?php
if (Config::has('sentry.key')) {
$bufferHandler = new Monolog\Handler\BufferHandler(
new Monolog\Handler\RavenHandler(
new Raven_Client(Config::get('sentry.key')),
Monolog\Logger::WARNING
)
);
// articles per page
var limit = 10;
// pagination middleware function sets some
// local view variables that any view can use
function pagination(req, res, next) {
var page = parseInt(req.params.page) || 1,
num = page * limit;
db.articles.count(function(err, total) {
res.local("total", total);
var _ = require('lodash');
/**
* `isValidationError`
*
* Is this a waterline validation error?
*/
function isWaterlineValidationError (err) {
if (_.isPlainObject(err)) {
-- PostgreSQL 9.2 beta (for the new JSON datatype)
-- You can actually use an earlier version and a TEXT type too
-- PL/V8 http://code.google.com/p/plv8js/wiki/PLV8
-- Inspired by
-- http://people.planetpostgresql.org/andrew/index.php?/archives/249-Using-PLV8-to-index-JSON.html
-- http://ssql-pgaustin.herokuapp.com/#1
-- JSON Types need to be mapped into corresponding PG types
--
package main
import (
"net/http"
"database/sql"
"fmt"
"log"
"os"
)
'use strict';
/**
*
* An Angular Jasmine testing utility
*
* @copyright 2013 Chris Sattinger
* MIT License
*
* automatically injects these services:
* '$httpBackend', '$rootScope', '$controller', '$compile'
## Customized for Laravel 4
# setting worker_processes to CPU core count
worker_processes 1;
daemon off;
events {
worker_connections 1024;
}
## Customized for Laravel 4
# setting worker_processes to CPU core count
worker_processes 1;
daemon off;
events {
worker_connections 1024;
}