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
| def getPagination(currentPage, totalNumberOfPages, beforeOrAfter = 2): | |
| start = max(1, currentPage - beforeOrAfter) | |
| stop = min(totalNumberOfPages, currentPage + beforeOrAfter) | |
| return range(start, stop + 1) | |
| print getPagination(5, 6) | |
| print getPagination(3, 6, 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
| define(function(require) { | |
| var View = require('base/view'); | |
| var menuTemplate = require('hgn!./menu'); | |
| var MenuView = View.extend({ | |
| template: menuTemplate, | |
| initialize: function(options) { |
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
| define(function(require) { | |
| var sinon = require('sinon'); | |
| var _ = require('underscore'); | |
| // fakeResponse | |
| // ------------ | |
| // | |
| // High-level helper for responding equally to all Ajax requests. | |
| // |
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
| hei |
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
| $(document).ready(function() { | |
| $('#new-status form').submit(function(e) { | |
| e.preventDefault(); | |
| $.ajax({ | |
| url: '/status', | |
| type: 'POST', | |
| dataType: 'json', | |
| data: { text: $('#new-status').find('textarea').val() }, | |
| success: function(data) { |
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
| <plugin> | |
| <artifactId>maven-war-plugin</artifactId> | |
| <version>2.3</version> | |
| <configuration> | |
| <warSourceExcludes>**</warSourceExcludes> | |
| <webResources> | |
| <webResource> | |
| <directory>${basedir}/src/main/webapp/WEB-INF</directory> | |
| <includes> | |
| <include>web.xml</include> |
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 gulp = require('gulp'); | |
| var concat = require('gulp-concat'); | |
| var header = require('gulp-header'); | |
| var footer = require('gulp-footer'); | |
| var templateCache = require('./template-cache'); | |
| var templateCacheWrapper = require('./template-cache-wrapper'); | |
| gulp.task('default', function() { | |
| var templateHeader = "{{ angular }}.module('{{ module }}'{{ standalone }}).run(['$templateCache', function($templateCache) {\n"; | |
| var templateFooter = "}]);\n" |
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
| npm test 2>&1 | grep -m1 -B1000 '\.\.\.' |
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
| <!DOCTYPE html> | |
| <html ng-app="myApp"> | |
| <head> | |
| <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.1/angular.min.js"></script> | |
| <meta charset="utf-8"> | |
| <title>JS Bin</title> | |
| </head> | |
| <body> | |
| <div ng-controller="GreetingController"> | |
| <label>Name: <input type="text" ng-model="name"></label> |
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 net = require('net'); | |
| var socket = net.connect({ port: 8001 }); | |
| process.stdin | |
| .pipe(socket) | |
| .pipe(process.stdout); |