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
| ## coding: utf-8 | |
| # Demo mongoDB mapreduce with callendar | |
| require 'date' | |
| require 'mongo' | |
| require 'securerandom' | |
| require 'pp' | |
| # Create calendar collection with random string name, |
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
| express = require 'express' | |
| mongoose = require 'mongoose' | |
| SessionMongoose = require 'session-mongoose' | |
| Resource = require 'express-resource' | |
| messages = require 'express-messages' | |
| db = require './db' | |
| app = module.exports = express.createServer() | |
| User = null |
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.config({ | |
| urlArgs: (new Date()).getTime(), | |
| baseUrl: './' | |
| }); | |
| window.createContext = stubContext({ | |
| shim: { | |
| 'underscore': { | |
| exports: '_' | |
| }, |
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 express = require('express') | |
| , io = require('socket.io'); | |
| var app = express() | |
| , server = require('http').createServer(app) | |
| , io = io.listen(server); | |
| server.listen(3000); | |
| io.sockets.on('connection', function(socket) { |
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
| describe('when add event is fired on Todos collection', function() { | |
| before(function() { | |
| var init = this.TodoList.prototype.initialize; | |
| // spying event related method | |
| this.TodoList.prototype.initialize = function() { | |
| sinon.spy(this, 'renderOne'); | |
| init.apply(this, arguments); | |
| }; |
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() { | |
| // 最初からページに全部在る場合 | |
| var limit = 3 | |
| , start = 0 | |
| , end = limit; | |
| // 初期表示 | |
| $('.item').slice(start, end).show(); | |
| $('.item').slice(end).hide(); |
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
| buster.spec.expose(); | |
| var TodoList = require('todo/src/views/todo-list.js'); | |
| describe('TodoList view', function() { | |
| it('TodoList関数が定義されていること', function() { | |
| expect(TodoList).toBeFunction(); | |
| }); | |
| }); |
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
| buster.spec.expose(); | |
| var Backbone = require('solutionio-backbone'); | |
| // Mock | |
| var Todos = Backbone.Collection.extend() | |
| , TodoItem = Backbone.View.extend(); | |
| var TodoList; |
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
| #todo-list li.editing { | |
| border-bottom: none; | |
| padding: 0; | |
| } | |
| #todo-list li.editing .edit { | |
| display: block; | |
| width: 506px; | |
| padding: 13px 17px 12px 17px; | |
| margin: 0 0 0 43px; |
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
| RSpec::Matchers.define :be_sorted_by do |key, order| | |
| match do |array| | |
| operator = order == :asc ? :<= : :>= | |
| array.each_cons(2).all?{ |cons| cons[0][key].send(operator, cons[1][key]) } | |
| end | |
| failure_message_for_should do |array| | |
| "expected #{array} to be sorted in #{key} #{order.to_s}" | |
| end |
OlderNewer