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
# | |
# This is an example VCL file for Varnish. | |
# | |
# It does not do anything by default, delegating control to the | |
# builtin VCL. The builtin VCL is called when there is no explicit | |
# return statement. | |
# | |
# See the VCL chapters in the Users Guide at https://www.varnish-cache.org/docs/ | |
# and http://varnish-cache.org/trac/wiki/VCLExamples for more examples. |
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
Room.find({}).sort('-date').exec(function(err, docs) { ... }); | |
Room.find({}).sort({date: -1}).exec(function(err, docs) { ... }); | |
Room.find({}).sort({date: 'desc'}).exec(function(err, docs) { ... }); | |
Room.find({}).sort({date: 'descending'}).exec(function(err, docs) { ... }); | |
Room.find({}, null, {sort: {date: -1}}, function(err, docs) { ... }); | |
Room.find({}, null, {sort: [['date', -1]]}, function(err, docs) { ... }); |
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
/** | |
* Example of a Email utils library | |
* | |
* Usage: | |
* var EmailUtils = require("./utils"); | |
* EmailUtils.validateEmail("[email protected]"); | |
*/ | |
"use strict"; |
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
# Normal users | |
backend default { | |
.host = "127.0.0.1"; | |
.port = "8080"; | |
} | |
# WP-Admin users | |
backend admin_backend { | |
.host = "127.0.0.1"; | |
.port = "8080"; |
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 uri = "mongodb://write.server.com/mydatabase,read.server.com/mydatabase?replicaSet=rs-test&readPreference=nearest"; | |
connection = mongoose.connection; | |
mongoose.connect(uri, {}); |
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
// Mongoose.js and mocha/should testing with unique index constraints | |
// Use this snippet in your test, change the values to match your indexes | |
beforeEach(function(done) { | |
mongoose.connection.models.YourModelNameHere.collection.ensureIndex( | |
{ | |
fieldWithConstraint: 1, | |
anotherFieldWithConstraint: 1 | |
}, | |
{ |
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
/* Updates all statistics */ | |
USE <database> | |
EXEC sp_updatestats |
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
<!-- To get bundles to work when not debugging (as in minified) you might need this in web.config --> | |
<!-- It's only the bundlemodule you need, the other is just to show where it should be placed --> | |
<system.webServer> | |
<modules runAllManagedModulesForAllRequests="true"> | |
<add name="BundleModule" type="System.Web.Optimization.BundleModule"/> | |
</modules> | |
</system.webServer> |
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 | |
// Recognize protocol from load balancer/varnish | |
if (isset($_SERVER["HTTP_X_FORWARDED_PROTO"]) && $_SERVER["HTTP_X_FORWARDED_PROTO"] == "https") { | |
$_SERVER["HTTPS"] = "on"; | |
} | |
// Forward ip from load balancer/varnish | |
if (isset($_SERVER["HTTP_X_FORWARDED_FOR"])) { | |
$_SERVER["REMOTE_ADDR"] = $_SERVER["HTTP_X_FORWARDED_FOR"]; |
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
{ | |
"Version": "2008-10-17", | |
"Statement": [ | |
{ | |
"Sid": "AllowPublicRead", | |
"Effect": "Allow", | |
"Principal": { | |
"AWS": "*" | |
}, | |
"Action": "s3:GetObject", |
NewerOlder