This file contains 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
module AutoRollbackBehavior | |
def run(runner) | |
test_result = nil | |
DB.transaction do | |
test_result = super | |
raise Sequel::Rollback | |
end | |
test_result | |
end | |
end |
This file contains 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
class Query | |
def self.query_name | |
:return_valid_query_name_in_subclass_or_you_will_get_really_weird_results | |
end | |
def self.create_prepared_statement(sql, placeholders_array) | |
sql = sql.super_strip unless Environment.log_sql? | |
DB[sql, *placeholders_array].prepare(:select, query_name) | |
end |
This file contains 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 mongoose = require('mongoose'), | |
crypto = require('crypto'), | |
uuid = require('node-uuid'), | |
Schema = mongoose.Schema, | |
ObjectId = Schema.ObjectId; | |
var userSchema = new Schema({ | |
name: { type: String, required: true, unique: true }, | |
email: { type: String, required: true }, | |
salt: { type: String, required: true, default: uuid.v1 }, |
This file contains 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
<VirtualHost 109.74.199.47:80> | |
ServerAdmin [email protected] | |
ServerName thatextramile.be | |
ServerAlias www.thatextramile.be | |
ProxyRequests off | |
<Proxy *> | |
Order deny,allow | |
Allow from all |
This file contains 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 express = require('express'), | |
app = module.exports = express.createServer(), | |
NodePie = require('nodepie'), | |
request = require('request'), | |
recentFeedItems = null; | |
app.dynamicHelpers({ | |
getRecentFeedItems: function() { | |
return recentFeedItems; | |
} |
This file contains 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 invoiceSchema = new Schema({ | |
companyId: { type: ObjectId, required: true }, | |
customerId: { type: ObjectId, required: true }, | |
invoiceNumber: { type: String, required: true, unique: true }, | |
date: { type: Date, required: true }, | |
dueDate: { type: Date, required: true }, | |
paid: { type: Boolean, required: true, default: false }, | |
activityId: { type: ObjectId, required: true }, | |
totalHours: { type: Number, required: true }, | |
hourlyRate: { type: Number, required: true }, |
This file contains 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('given an existing customer', function() { | |
describe('when it is retrieved from the database', function() { | |
it('should contain the same values that have been inserted', function() { | |
var customer = new CustomerBuilder() | |
.withIncludeContactOnInvoice() | |
.build(); | |
customer.save(function(err) { |
This file contains 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 exec = require('child_process').exec; | |
function getJsFilesRecursively(startPath, callback) { | |
exec('find ' + startPath, function(err, stdout) { | |
var jsFiles = []; | |
stdout.split('\n').forEach(function(f) { | |
if (!/node_modules\//.test(f) && /.js$/.test(f)) { | |
jsFiles.push(f); | |
}; | |
}); |
This file contains 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 mongoose = require('mongoose'), | |
Schema = mongoose.Schema, | |
ObjectId = Schema.ObjectId; | |
var customerSchema = new Schema({ | |
name: { type: String, required: true }, | |
address: { | |
street: { type: String, required: true }, | |
postalCode: { type: String, required: true }, | |
city: { type: String, required: true }, |
This file contains 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
public class ConventionsBasedRequiredAttributeAdapter : RequiredAttributeAdapter | |
{ | |
public ConventionsBasedRequiredAttributeAdapter(ModelMetadata metadata, ControllerContext context, RequiredAttribute attribute) | |
: base(metadata, context, attribute) {} | |
public override IEnumerable<ModelClientValidationRule> GetClientValidationRules() | |
{ | |
string errorMessage; | |
var className = Metadata.ContainerType.Name; |
NewerOlder