-
Install any of the Mongo add-ons available at http://addons.heroku.com
-
Vendor the Mongo driver with your application. You can download it here:
https://github.com/wuputah/heroku-libraries/raw/master/php/mongo/mongo.soAdd it to a folder like "ext".
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
| /* Builds a list of images found in the linked style sheets | |
| * | |
| * Adapted from stackoverflow.com/questions/2430503/list-of-all-background-images-in-dom/2453880#2453880 | |
| * | |
| * This method has the advantage of finding URLs for background images that no | |
| * element in the DOM uses yet. | |
| * | |
| * @return {array} | |
| * List of unique image URLs as specified in the style sheets. | |
| ------------------------------------------------------------------------- */ |
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
| /*! ****************************** | |
| Handlebars helpers | |
| *******************************/ | |
| // debug helper | |
| // usage: {{debug}} or {{debug someValue}} | |
| // from: @commondream (http://thinkvitamin.com/code/handlebars-js-part-3-tips-and-tricks/) | |
| Handlebars.registerHelper("debug", function(optionalValue) { | |
| console.log("Current Context"); | |
| console.log("===================="); |
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
| #!/bin/sh | |
| LOCAL_BRANCH="master" | |
| LIVE_BRANCH="live" | |
| REMOTE_NAME="deploy" | |
| if [ "$(git symbolic-ref -q HEAD)" != "refs/heads/${LOCAL_BRANCH}" ]; then | |
| echo "Not on ${LOCAL_BRANCH}, not deploying" | |
| exit 1 | |
| else |
Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
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
| /* | |
| * Copyright © 2012 by Scott Perry | |
| * Released under the MIT License; its terms are at the end of this file. | |
| * | |
| * This file depends on: | |
| * • jQuery (tested against 1.7.1) | |
| * http://jquery.com/ | |
| * | |
| * Basic logic of this file: | |
| * + if irsz_auto is true |
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
| /** | |
| * Remove utm parameters from url | |
| * ( Use this as bookmarklet ) | |
| */ | |
| (function(){ | |
| var search, params, i, re; | |
| search = location.search.replace( /^\?/, '' ).split( '&' ); | |
| params = []; | |
| if (!search) return; | |
| i = search.length; |
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 application_root = __dirname, | |
| express = require("express"), | |
| path = require("path"), | |
| mongoose = require('mongoose'); | |
| var app = express.createServer(); | |
| // database | |
| mongoose.connect('mongodb://localhost/ecomm_database'); |
This gist assumes:
- you have a local git repo
- with an online remote repository (github / bitbucket etc)
- and a cloud server (Rackspace cloud / Amazon EC2 etc)
- your (PHP) scripts are served from /var/www/html/
- your webpages are executed by apache
- apache's home directory is /var/www/
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
| db.test.insert({'name': 'rizky', 'abilities': ['eat', 'sleep', 'code']}); | |
| db.test.insert({'name': 'abdilah', 'abilities': ['drink']}); | |
| db.test.insert({'name': 'median', 'abilities': null}); | |
| condition_have_ability_more_than_2 = function(){ | |
| return typeof(this.abilities) == "object" && this.abilities != null && this.abilities.length > 2; | |
| } | |
| // peoples have abilities more_than_2 | |
| db.test.find(condition_have_ability_more_than_2); |