Skip to content

Instantly share code, notes, and snippets.

@tleite
tleite / gist:5219073
Last active December 15, 2015 06:49
This is a way to bind Bootstrap's accordion behavior directly in the view
<script>
ko.bindingHandlers.collapseAccordion = {
init: function(element, valueAccessor, allBindingsAccessor, viewModel) {
if($(element).hasClass("collapse")){
$(element).removeClass("collapse").attr().addClass("in");
} else {
$(element).removeClass("in").addClass("collapse").attr("style","height:0px");
}
}
}
// if localStorage is present, use that
if (('localStorage' in window) && window.localStorage !== null) {
// easy object property API
localStorage.wishlist = '["Unicorn","Narwhal","Deathbear"]';
} else {
// without sessionStorage we'll have to use a far-future cookie
// with document.cookie's awkward API :(
@tleite
tleite / gist:5041114
Last active December 14, 2015 06:18
Example of how block commenting can cause syntax error in Javascript
/*
var rm_a = /a*/.match(s);
*/
@tleite
tleite / gist:3196459
Created July 29, 2012 06:52
Error when deploying
info: Welcome to Nodejitsu tleite
info: It worked if it ends with Nodejitsu ok
info: Executing command deploy
info: Analyzing your application dependencies in server.js
info: Creating snapshot 0.0.1-3
info: Updating app LaunchTicker
info: Activating snapshot 0.0.1-3 for LaunchTicker
info: Starting app LaunchTicker
error: Error running command deploy
error: Nodejitsu Error (500): Internal Server Error
@tleite
tleite / gist:3196410
Created July 29, 2012 06:30
Nodejitsu error when deploying
error: Error running command deploy
error: Nodejitsu Error (500): Internal Server Error
error: There was an error while attempting to deploy your application.
error:
error: NPM Install failed
error: NPM failed to install dependencies
error:
error: This type of error is usually a user error.
error: Error output from Haibu:
error: