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 popupwindow = function (url, title, w, h) { | |
var left = (screen.width/2)-(w/2); | |
var top = (screen.height/2)-(h/2); | |
return window.open(url, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left); | |
}; |
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
/* | |
* Given an image URL or path, crop and resize it to be exactly a specific size. | |
* Crops centrally to force enforce the correct aspect ratio, and then resizes as per normal. | |
* Depends on the `when` and `gm` NPM modules. | |
* Returns a promise that resolves with an image buffer in a .PNG format. | |
*/ | |
var when = require('when'); | |
var gm = require('gm'); | |
var im = gm.subClass({ imageMagick: true }); // use `im` in place of `gm` for heroku compatibility |
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
(function($) { | |
var BadBrowser = { | |
show: function() { | |
var _this = this; | |
if (_this.isIE8orLower()) { | |
_this.showMessage(); | |
} | |
}, |
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.exports.bootstrap = function (cb) { | |
// Ensure we have 2dsphere index on Property so GeoSpatial queries can work! | |
sails.models.YOURMODEL.native(function (err, collection) { | |
collection.ensureIndex({ coordinates: '2dsphere' }, function () { | |
// It's very important to trigger this callack method when you are finished | |
// with the bootstrap! (otherwise your server will never lift, since it's waiting on the bootstrap) | |
cb(); |
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
#!/bin/sh | |
GIT_WORK_TREE=/home/myuser/public_html/wp-content/themes/mytheme git checkout -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
window.Sauce = { | |
isReady: false, | |
options: {}, | |
object: {}, | |
describe: function (type, data) { | |
this.object[type] = data; |
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
// Sample options to pass to Keen.configure | |
// { | |
// projectId: "your_project_id", | |
// writeKey: "your_write_key", | |
// } | |
var loadKeen = function (options, cb) { | |
var iframe = document.createElement("iframe"); | |
iframe.style.display = "none"; |
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 indexOf = function(arr, item, fromIndex) { | |
fromIndex = fromIndex || 0; | |
if (arr === null) { | |
return -1; | |
} | |
var len = arr.length, | |
i = fromIndex < 0 ? len + fromIndex : fromIndex; | |
while (i < len) { | |
// we iterate over sparse items since there is no way to make it |
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 average = function (arr) { | |
var total = 0; | |
forEach(arr, function (number) { | |
total += number; | |
}); | |
return total / arr.length; | |
}; |