This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Inspired by http://bulkan-evcimen.com/using_sequelize_migrations_with_an_existing_database | |
var Promise = require('bluebird'); | |
var fs = Promise.promisifyAll(require('fs')); | |
module.exports = { | |
up: function(migration, DataTypes, done) { | |
var db = migration.migrator.sequelize; | |
fs.readFileAsync(__dirname + '/initial.sql', {encoding: 'utf8'}) | |
.then(function(initialSchema) { | |
var tables = initialSchema.split(';'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
trait EventGenerator | |
{ | |
protected $pendingEvents = array(); | |
protected function raise($event) | |
{ | |
$this->pendingEvents[] = $event; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ini_set("memory_limit","200M"); | |
if( !empty($_SERVER['HTTP_ORIGIN']) ){ | |
// Enable CORS | |
header('Access-Control-Allow-Origin: ' . $_SERVER['HTTP_ORIGIN']); | |
header('Access-Control-Allow-Methods: POST, GET, OPTIONS'); | |
header('Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Range, Content-Disposition, Content-Type'); | |
} | |
if( $_SERVER['REQUEST_METHOD'] == 'OPTIONS' ){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var util = require('util'); | |
it('should upload file', function() { | |
var fileToUpload = '../some/path/foo.txt'; | |
var absolutePath = path.resolve(__dirname, fileToUpload); | |
$('input[type="file"]').sendKeys(absolutePath); | |
$('#uploadButton').click(); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A commented nginx configuration file for Ruby on Rails | |
# | |
# Author: Tommaso Pavese | |
# [email protected] | |
# http://tommaso.pavese.me | |
# | |
# License: http://www.wtfpl.net/ | |
# | |
# | |
# Tested with: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app/policies/active_admin/ | |
module ActiveAdmin | |
class CommentPolicy < ApplicationPolicy | |
class Scope < Struct.new(:user, :scope) | |
def resolve | |
scope | |
end | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('e2e: main', function() { | |
var ptor; | |
beforeEach(function() { | |
browser.get('/'); | |
ptor = protractor.getInstance(); | |
}); | |
it('should load the home page', function() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var _ = require('lodash'); | |
/** | |
* `isValidationError` | |
* | |
* Is this a waterline validation error? | |
*/ | |
function isWaterlineValidationError (err) { | |
if (_.isPlainObject(err)) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- 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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* User | |
* | |
* @module :: Model | |
* @description :: A short summary of how this model works and what it represents. | |
* | |
*/ | |
var uuid = require('node-uuid') | |
var bcrypt = require('bcrypt') | |
, SALT_WORK_FACTOR = 10 |