This is a template for creating Bootstrap pagination with Backbone.js and backbone.paginator.
Based on the Digg-Style Pagination script for PHP.
| function pad(num) { | |
| return (num < 10 ? '0' : '') + num; | |
| } | |
| function formatDateMonthDayYear(date) { | |
| if (date) { | |
| date = new Date(date); | |
| } else { | |
| date = new Date(); | |
| } |
| function reverseIt(str) { | |
| return str.split('').reverse().join(''); | |
| } |
| var _ = _ || {}; | |
| _.contains = function (obj, target) { | |
| if (obj == null) return false; | |
| if (Array.prototype.indexOf && obj.indexOf === Array.prototype.indexOf) return obj.indexOf(target) != -1; | |
| return obj.some(function(value) { | |
| return value === target; | |
| }); | |
| }; |
This is a template for creating Bootstrap pagination with Backbone.js and backbone.paginator.
Based on the Digg-Style Pagination script for PHP.
| /* global $, _ */ | |
| var TemplateManager = {}; | |
| (function () { | |
| 'use strict'; | |
| var cache = {}; | |
| TemplateManager.template = function (path) { |
| ################################################################################# | |
| # start and stop the vpn from the command line from now on with these two commands | |
| # or rename the aliases as you see fit. | |
| ################################################################################# | |
| alias startvpn="sudo launchctl load -w /Library/LaunchDaemons/net.juniper.AccessService.plist; open -a '/Applications/Junos Pulse.app/Contents/Plugins/JamUI/PulseTray.app/Contents/MacOS/PulseTray'" | |
| alias quitvpn="osascript -e 'tell application \"PulseTray.app\" to quit';sudo launchctl unload -w /Library/LaunchDaemons/net.juniper.AccessService.plist" |
| <!-- switch to htts if available --> | |
| <a href="javascript:(function(){if(location.protocol!='https:'){location.href='https:'+window.location.href.substring(window.location.protocol.length);}})();">HTTPS Switcher</a> |
| # editorconfig.org | |
| root = true | |
| [*] | |
| indent_style = space | |
| indent_size = 2 | |
| end_of_line = lf | |
| charset = utf-8 | |
| trim_trailing_whitespace = true | |
| insert_final_newline = true |
JavaScript has pretty normal control-flow statements that use blocks delineated by curly braces. There is an exception to this: the switch ... case statement. The strange thing about switch ... case is that you must include the keyword break at the end of each case to prevent control from falling through to the next case. Fall through is a trick that allows you to let more than one case be executed. Control will fall through automatically to the next case unless you explicitly tell it not to with break. However, like the optional semicolons and curly braces, it's possible to forget break when you really should have used it. When that happens, the bug is difficult to find because the code looks correct. For that reason, the break statement should never be left off of a case, even by design.
With that said, JavaScript has an elegant object-literal syntax and first-class functions, which makes it simple to create a keyed method lookup. The object you create for your method lookup is call