Skip to content

Instantly share code, notes, and snippets.

@DanWahlin
Last active August 29, 2015 14:18
Show Gist options
  • Save DanWahlin/ae61b8f75ec2efdece51 to your computer and use it in GitHub Desktop.
Save DanWahlin/ae61b8f75ec2efdece51 to your computer and use it in GitHub Desktop.
Sample of my solvedIssues.md file that I add into every project
##Dust helpers not loading
Removed Dust.js functionality but leaving this in for future reference.
Inside the dustjs-helpers folder in your node_modules, you will notice dustjs-linkedin is version 2.3.5,
while in the node_modules folder of your app there is another version of dustjs-linkedin which is 2.4.0.
I deleted the older version and then everything works well.
https://github.com/krakenjs/kraken-js/issues/236
##Middleware calls (such as to get productTypes) made multiple times due to favicon
Installed and used server-favicon module to fix this and added to root index.js
Used http://www.favicon.cc/ to generate favicon
##QueryString on URL caused custom middleware calls
The ?discountCode=xxxx param was causing the discount code to load.
It was doing a "return" after res.render() which messed everything up.
##Navbar was collapsing incorrectly when in mobile views.
Was due to the "collapse" class missing from a div <div class="collapse navbar-collapse" id="menu-collapse">
##ng-model properties weren't updating properly with ng-if showing/hiding sections
Used ng-show/ng-hide instead so the objects aren't added/removed to and from the DOM
##Had a problem figuring out doing &&|| conditions in the dust templates. Even considered a custom helper.
If you're spending too much time worrying about logic in templates you're probably doing it wrong. Put that logic
in a controller (or other backend object) and let it send a single property into the template that can be evaluated.
##Had a problem with the Vimeo player giving errors about "videos" being null, cross-domain issues with
the iFrame, etc.
Make sure that the Froogaloop ($f) script isn't creating a player before the iFrame has loaded. Doing that
will cause the cross-domain issue. Do something like this with the player the first time it needs to be created:
if (!player) {
iFrame.load(function() {
player = $f(iFrame[0]);
player.addEvent('ready', videoReady);
});
}
##express-session isn't for production
Removed Kraken functionality but leaving this in for future reference.
express-session isn't for production so switched to cookie-session. It doesn't currently allow session keys to start
with "_" and Lusca (KrakenJS uses it) sets that type of key for CSRF which breaks things. Here's the temporary fix:
1. Turned off CSRF in node_modules/kraken-js/config/config.json for Lusca
2. Added csurf module into index.js (root) instead
3. Also added res.locals._csrf = req.csrfToken(); for each request into index.js (root) to ensure that value makes it down to the browser with each request as needed.
4. Sessions are now in cookies and CSRF works.
Once Lusca updates and allows the key name to change or cookie-session changes and support "_" at the start of a key I'll update things.
##How can you easily update all npm modules?
$ npm install -g npm-check-updates
$ npm-check-updates -u
$ npm install
Be very, very careful though - this can cause versioning issues!!
##Difference between ~ and ^ in package.json for versions (since it's easy to forget)
https://www.npmjs.org/doc/files/package.json.html
~version "Approximately equivalent to version"
^version "Compatible with version"
##Uncaught TypeError: Cannot read property 'ready' of undefined - froogaloop.js:213
When iframe load() fires, froogaloop tries to return a callback object that doesn't exist.
had to modify the following code (unfortunately):
```
function getCallback(eventName, target_id) {
if (target_id) {
//Added this line
if (!eventCallbacks[target_id]) return null;
return eventCallbacks[target_id][eventName];
}
else {
return eventCallbacks[eventName];
}
}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment