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
require.paths.unshift('./node_modules'); | |
require('should'); | |
var assert = require('assert'); | |
var mongoose = require('mongoose') | |
, Schema = mongoose.Schema | |
, mongooseTypes = require("mongoose-types") | |
, db = mongoose.createConnection(getMongoUrl()); | |
mongooseTypes.loadTypes(mongoose); |
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
/* Say you want to add multiple validation middlewares to Express app, this is an example of how to do it. | |
First create 2 middlewares: first one(e.g. validateRequest1) to validate and the 2nd one to handle errors (e.g validateRequest1Handler). | |
If you want to add a 2nd validation middleware, create two more middlewares (validateRequest2 & validateRequest2Handler). | |
Note - Error-handling-middleware v/s non-error-handling-middleware | |
Error handler middleware must take 4 parameters(err, req, res, next) including "err" as first parameter. Where as are normal middlewares only take 3(req, res, next). | |
*/ | |
//This is how it would look like.. |
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
AdvancedNewFile | |
AngularJS | |
BracketHighlighter | |
DocBlockr | |
FileDiffs | |
JSFormatter | |
PackageControl | |
SideBarEnhancements | |
SideBarGit | |
Sublime-HtmlPrettify |
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 how HTML, Controller & Directive looked in my actual app at this point. | |
//Notice that we are applying masonry for every element as they are added by ng-repeat. | |
//HTML | |
/* | |
<div id="photoContainer" style="position:relative;height:800px;zoom:1;"> | |
<div class="photo" ng-repeat="photoPost in photoPosts"> | |
<img ng-src="{{photoPost.photo.url}}" add-masonry="photoPost"></div> | |
</div> | |
</div> |
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
function myFunction(param1) { | |
this.param1 = param1; | |
} |
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
//Added imagesLoaded code to wait for all images to load before we apply masonry. | |
//But this wasn't working either! Because Angular hasn't converted ng-src="path/to/img" to src="path/to/img" | |
clientAppModule.directive('addMasonry', function($timeout) { | |
return { | |
restrict: 'A', | |
link: function(scope, element) { | |
scope.container.imagesLoaded(function() { | |
scope.container.masonry('reload'); | |
}); | |
} |
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
//Wrap masonry with ImagesLoaded and wrap that again with a $timeout w/ a small delay solves the issue. | |
clientAppModule.directive('addMasonry', function($timeout) { | |
return { | |
restrict: 'A', | |
link: function(scope, element) { | |
$timeout(function(val) { //looks like timeout or deferred solves the issue | |
scope.container.imagesLoaded(function() { | |
scope.container.masonry('reload'); | |
}); |
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
<apex:page sidebar="false" showheader="false" standardController="Warehouse__c" recordSetVar="warehouses" extensions="FindNearby"> | |
<!-- (Won't work anymore) Include in Google's Maps API via JavaScript static resource | |
<apex:includeScript value="{!$Resource.googleMapsAPI}" /> | |
--> | |
<!-- Set this API key to fix JavaScript errors in production --> | |
<!--http://salesforcesolutions.blogspot.com/2013/01/integration-of-salesforcecom-and-google.html--> | |
<script type="text/javascript" | |
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDYaP-xy0Noe1HCeNOmWE2MZYwUcehnZM0&sensor=false"> |
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
-------------------------------- | |
Check Git version: | |
-------------------------------- | |
git --version | |
If you don't see one of the following, you should to update: | |
v1.8.5.6, v1.9.5, v2.0.5, v2.1.4, and v2.2.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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
OlderNewer