code
stringlengths
1
2.08M
language
stringclasses
1 value
// Copyright 2007 The Closure Library Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless requ...
JavaScript
// Copyright 2007 The Closure Library Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless requ...
JavaScript
// Copyright 2007 The Closure Library Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless requ...
JavaScript
// Copyright 2007 The Closure Library Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless requ...
JavaScript
// Copyright 2010 The Closure Library Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless requ...
JavaScript
// Copyright 2008 The Closure Library Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless requ...
JavaScript
// Copyright 2007 The Closure Library Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless requ...
JavaScript
// Copyright 2007 The Closure Library Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless requ...
JavaScript
// Copyright 2007 The Closure Library Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless requ...
JavaScript
// Copyright 2007 The Closure Library Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless requ...
JavaScript
// Copyright 2007 The Closure Library Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless requ...
JavaScript
// Copyright 2007 The Closure Library Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless requ...
JavaScript
// Copyright 2007 The Closure Library Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless requ...
JavaScript
// Copyright 2007 The Closure Library Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless requ...
JavaScript
// Copyright 2007 The Closure Library Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless requ...
JavaScript
// Copyright 2007 The Closure Library Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless requ...
JavaScript
// Copyright 2007 The Closure Library Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless requ...
JavaScript
// Copyright 2007 The Closure Library Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless requ...
JavaScript
// Copyright 2007 The Closure Library Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless requ...
JavaScript
// Copyright 2007 The Closure Library Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless requ...
JavaScript
// Copyright 2007 The Closure Library Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless requ...
JavaScript
// Copyright 2007 The Closure Library Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless requ...
JavaScript
// Copyright 2007 The Closure Library Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless requ...
JavaScript
// Copyright 2007 The Closure Library Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless requ...
JavaScript
// Copyright 2007 The Closure Library Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless requ...
JavaScript
// Copyright 2007 The Closure Library Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless requ...
JavaScript
// Copyright 2007 The Closure Library Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless requ...
JavaScript
// Copyright 2007 The Closure Library Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless requ...
JavaScript
// Copyright 2007 The Closure Library Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless requ...
JavaScript
// Copyright 2007 The Closure Library Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless requ...
JavaScript
// Copyright 2007 The Closure Library Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless requ...
JavaScript
// Copyright 2010 The Closure Library Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless requ...
JavaScript
goog.require('goog.dom'); function sayHi() { var newHeader = goog.dom.createDom('h1', {'style': 'background-color:#EEE'}, 'Hello world!'); goog.dom.appendChild(document.body, newHeader); }
JavaScript
/** * Show the width of the first splitpane on event changes. * @param {goog.events.Event} e The event */ var showWidth_ = function(e) { // alert(e.target.getFirstComponentSize()); // var el = document.getElementById('componentOneWidth'); // if (el) { // goog.dom.setTextContent(el, e.target.getFirstComp...
JavaScript
var sys = require("sys"); var http = require("http"); var fs = require("fs"); //* function parse(rootObject) { sys.puts("parse"); /* for (var p in rootObject) { // 方法 if ( typeof (obj[p]) == "function") { // obj[p](); sys.puts("function"); } else { // p 为属性名称,obj[p]为对应属性的值 // props+= ...
JavaScript
/* * 该文件用于读取Chrome的书签文件,并将其按来源网站重新分组 */ var sys = require("sys"); var fs = require("fs"); //* function parse(rootObject) { sys.puts("parse"); /* for (var p in rootObject) { // 方法 if ( typeof (obj[p]) == "function") { // obj[p](); sys.puts("function"); } else { // p 为属性名称,obj[p]为对应属性的...
JavaScript
/* * 本代码提取出所有的Sites */ var sys = require("sys"); var fs = require("fs"); fs.readFile("../datas/urls.json", function(err, data) { if (err) { sys.puts("err"); throw err; } sys.puts("File is OK!"); var obj = eval('(' + data + ')') sys.puts("start"); var array = []; for(var p in obj){ if(p...
JavaScript
var $ = require('jquery'); var http = require('http'); var sys = require("sys"); var fs = require("fs"); var mongodb = require('mongodb'); /* var options = { host : 'www.google.com.hk' //host: 'marshal.easymorse.com' //port: 80, //path: '/' }; var html = ''; http.get(options, function(res) { res.on('data', function(d...
JavaScript
var http = require('http'); var sys = require("sys"); var fs = require("fs"); var object = null; var tasks = []; var cur_url; function get_caption(url) { var newurl = url.replace("http://", '').replace("https://", '').replace("/", ''); var options = { host : newurl // host:'www.eygle.com' }; c...
JavaScript
{"title":"", "id":1, "dateAdded":1263046047160000, "lastModified":1280146486546000, "type":"text/x-moz-place-container", "root":"placesRoot", "children":[{"title":"书签菜单", "id":2, "parent":1, "dateAdded":1260955669000000, "lastModified":1324566913421000, "type":"text/x-moz-place-container", "root":"bookmarksMenuFolder",...
JavaScript
var curFolder = null; function toggleChildren(element) { $(element).next(".children").toggle(); $(element).children("#closed").toggle(); $(element).children("#open").toggle(); var urls = $(element).next().next().html(); $("#contents-urls-contents").html(urls); if(element != curFolder) { $(element).css("backgr...
JavaScript
{"title":"", "id":1, "dateAdded":1263046047160000, "lastModified":1280146486546000, "type":"text/x-moz-place-container", "root":"placesRoot", "children":[{"title":"书签菜单", "id":2, "parent":1, "dateAdded":1260955669000000, "lastModified":1324566913421000, "type":"text/x-moz-place-container", "root":"boo...
JavaScript
$(function() { var jadeCompile_root = null; var jadeCompile_folder = null; var jadeCompile_url = null; var bookmarksJson = null; function parse_urls(array) { return jadeCompile_url(array); } function parse_folders(object) { var html = jadeCompile_folder(object); $(html).find(".folders").html(...
JavaScript
$(document).ready(function() { // var folderNames = new Array; var sources = new Array; var path = new Array; var tabs = new Array; tabs.push("\t"); var txt = ""; /* var count = 0; function each(i, field) { var type = $.type(field); var tab = tabs.join("|"); if (type == "object") { parse_o...
JavaScript
(function() { // CommonJS require() function require(p){ var path = require.resolve(p) , mod = require.modules[path]; if (!mod) throw new Error('failed to require "' + p + '"'); if (!mod.exports) { mod.exports = {}; mod.call(mod.exports, mod, mod.exports, require.relative(path)); } ...
JavaScript
$(function() { $.get("pet.jade",function(jade_text) { var fn = jade.compile(jade_text); $.get("pet.json",function(json) { var html = fn(json); $('#pets').html(html); }); }); });
JavaScript
var client = new Db('test', new Server("127.0.0.1", 27017, {}), {w: 1}), test = function (err, collection) { collection.insert({a:2}, function(err, docs) { collection.count(function(err, count) { test.assertEquals(1, count); }); // Locate all the ent...
JavaScript
var mongodb = require('mongodb'); //var client = new mongodb.Db('test', new mongodb.Server("127.0.0.1", 27017, {}), {w: 1}); //client.dropDatabase(function(err, done) { //client.close(); //}); var client = new mongodb.Db('test', new mongodb.Server("127.0.0.1", 27017, {}), {w: 1}); var test_collection; var test = funct...
JavaScript
$(document).ready(function() { // var folderNames = new Array; var sources = new Array; var path = new Array; var tabs = new Array; tabs.push("\t"); var txt = ""; /* var count = 0; function each(i, field) { var type = $.type(field); var tab = tabs.join("|"); if (type == "object") { parse_o...
JavaScript
/** * CoffeeScript Compiler v1.4.0 * http://coffeescript.org * * Copyright 2011, Jeremy Ashkenas * Released under the MIT License */ (function(root) { var CoffeeScript = function() { function require(a) { return require[a] } return require["./helpers"] = new function() { var a = this; ((func...
JavaScript
/* * GET users listing. */ exports.list = function(req, res){ res.send("respond with a resource"); };
JavaScript
/* * GET home page. */ exports.index = function(req, res){ //res.render('index', { title: 'hello' }); res.render('test', { title: 'hello' }); };
JavaScript
/** * Module dependencies. */ var express = require('express') , routes = require('./routes') , user = require('./routes/user') , http = require('http') , path = require('path'); var app = express(); app.configure(function(){ app.set('port', process.env.PORT || 3000); app.set('views', __dirname + '...
JavaScript
var app = (require('express'))(); app.get('/hello.txt', function(req, res){ var body = 'Hello World'; res.setHeader('Content-Type', 'text/plain'); res.setHeader('Content-Length', body.length); res.end(body); }); app.get('/', function(req, res){ //res.send('hello world from csser.com!'); //res.render('.css...
JavaScript
#!/usr/bin/env node var browserify = require('browserify'); var bundle = browserify(); bundle.ignore([ 'stylus', 'markdown', 'discount', 'markdown-js', 'sys' ]); var viewStub = Math.random(); bundle.include(viewStub, '/node_modules/jadeify/views/index.js', ''); bundle.require({ jquery : 'jquery-browserify' }); bund...
JavaScript
#!/usr/bin/env node var browserify = require('browserify'); var bundle = browserify(); bundle.ignore([ 'stylus', 'markdown', 'discount', 'markdown-js', 'sys' ]); var viewStub = Math.random(); bundle.include(viewStub, '/node_modules/jadeify/views/index.js', ''); bundle.require({ jquery : 'jquery-browserify' }); bund...
JavaScript
var views = require('jadeify/views'); var jade = require('jade'); var traverse = require('traverse'); var $ = require('jquery'); module.exports = function (file, vars, opts) { if (!opts) opts = {}; if (!vars) vars = {}; opts.locals = traverse(vars).map(function (node) { if (node instanceof $) { ...
JavaScript
module.exports = function () { throw new Error('This module is meant to be loaded with .use()'); };
JavaScript
var fs = require('fs'); var path = require('path'); var Seq = require('seq'); var vm = require('vm'); var fileify = require('fileify'); var browserify = require('browserify'); var cache = JSON.parse( fs.readFileSync(__dirname + '/_cache.js', 'utf8') ); module.exports = function (opts, ext) { if (!opts) opts ...
JavaScript
var jadeify = require('jadeify'); var deck = require('deck'); var $ = require('jquery'); $(window).ready(function () { setInterval(function () { var titles = [ 'foo', 'bar', 'baz' ]; var bodies = [ 'what', 'lul', 'oh hello' ]; var msg = jadeify('msg.jade', { title : dec...
JavaScript
var express = require('express'); var app = express.createServer(); var util = require('util'); app.use(express.static(__dirname + '/static')); app.get('/', function (req, res) { res.render('index.jade', { layout : false }); }); var browserify = require('browserify'); var jadeify = require('jadeify'); util.prin...
JavaScript
var jadeify = require('jadeify'); var deck = require('deck'); var $ = require('jquery'); $(window).ready(function () { setInterval(function () { var titles = [ 'foo', 'bar', 'baz' ]; var bodies = [ 'what', 'lul', 'oh hello' ]; var body = jadeify('body.jade', { date : ne...
JavaScript
var express = require('express'); var app = express.createServer(); var util = require('util'); app.use(express.static(__dirname + '/static')); app.get('/', function (req, res) { res.render('index.jade', { layout : false }); }); var browserify = require('browserify'); var jadeify = require('jadeify'); util.prin...
JavaScript
var assert = require('assert'); var vm = require('vm'); var fs = require('fs'); var browserify = require('browserify'); var jadeify = require('../'); var jade = require('jade'); var jsdom = require('jsdom'); exports.simple = function () { var bundle = browserify().use(jadeify(__dirname + '/simple', 'jade')); ...
JavaScript
var assert = require('assert'); var vm = require('vm'); var fs = require('fs'); var browserify = require('browserify'); var jadeify = require('../'); var jade = require('jade'); var jsdom = require('jsdom'); exports.vars = function () { var bundle = browserify().use(jadeify(__dirname + '/vars', 'jade')); var...
JavaScript
/*! * mustache.js - Logic-less {{mustache}} templates with JavaScript * http://github.com/janl/mustache.js */ /*global define: false*/ (function (root, factory) { if (typeof exports === "object" && exports) { module.exports = factory; // CommonJS } else if (typeof define === "function" && define.amd) { ...
JavaScript
require('./helper'); var Writer = Mustache.Writer; describe('A new Mustache.Writer', function () { var writer; beforeEach(function () { writer = new Writer; }); it('loads partials correctly', function () { var partial = 'The content of the partial.'; var result = writer.render('{{>partial}}', {}, ...
JavaScript
require('./helper'); // A map of templates to their expected token output. Tokens are in the format: // [type, value, startIndex, endIndex, subTokens]. var expectations = { '' : [], '{{hi}}' : [ [ 'name', 'hi', 0, 6 ] ], '{{hi.world}}' ...
JavaScript
({ name: "Joe", greeting: "Welcome" })
JavaScript
({})
JavaScript
({ name: "Tater", helper: "To tinker?", bolder: function () { return function (text, render) { return text + ' => <b>' + render(text) + '</b> ' + this.helper; } } })
JavaScript
({ title: function () { return "Bear > Shark"; } })
JavaScript
({ a_string: 'aa', a_list: ['a','b','c'] })
JavaScript
({ foo: 1 })
JavaScript
({ name: "A Book", authors: ["John Power", "Jamie Walsh"], price: { value: 200, vat: function () { return this.value * 0.2; }, currency: { symbol: '$', name: 'USD' } }, availability: { status: true, text: "In Stock" }, // And now, some truthy false values tr...
JavaScript
({ number: function(text, render) { return function(text, render) { return +render(text); } } })
JavaScript
({ tag1: "Hello", tag2: "World" })
JavaScript
({ "person?": { name: "Jon" } })
JavaScript
({ foo: true, bar: "{{win}}", win: "FAIL" })
JavaScript
({ bold: function () { return function (text, render) { return '<b>' + render(text) + '</b>'; }; }, person: { name: 'Jonas' } });
JavaScript
({ "emptyString": "", "emptyArray": [], "zero": 0, "null": null, "undefined": undefined, "NaN": 0/0 })
JavaScript
({ title: function () { return "Welcome"; }, again: "Goodbye" })
JavaScript
({ array: ['1', '2', '3', '4'] })
JavaScript
({ header: function () { return "Colors"; }, item: [ {name: "red", current: true, url: "#Red"}, {name: "green", current: false, url: "#Green"}, {name: "blue", current: false, url: "#Blue"} ], link: function () { return this["current"] !== true; }, list: function () { return t...
JavaScript
({ tag: "yo" })
JavaScript
({ bedrooms: true, total: 1 })
JavaScript
({ jobs: [] })
JavaScript
({ numbers: [ {i: '1'}, {i: '2'}, {i: '3'}, {i: '4'} ] })
JavaScript
({ items: [ { name: 'name', items: [1, 2, 3, 4] } ] })
JavaScript
({ greeting: function () { return "Welcome"; }, farewell: function () { return "Fair enough, right?"; }, name: "Chris", value: 10000, taxed_value: function () { return this.value - (this.value * 0.4); }, in_ca: true })
JavaScript
({})
JavaScript
({ html: "I like {{mustache}}" })
JavaScript
({ name: 'Joe', friends: null })
JavaScript
({ title: function () { return "A Comedy of Errors"; } })
JavaScript
({ terms: [ {name: 't1', index: 0}, {name: 't2', index: 1} ] })
JavaScript
({ message: "Some <code>" })
JavaScript
({ title: function () { return "Bear > Shark"; }, entities: "&quot; \"'<>/" })
JavaScript
({ grand_parent_id: 'grand_parent1', parent_contexts: [ { parent_id: 'parent1', child_contexts: [ { child_id: 'parent1-child1' }, { child_id: 'parent1-child2' } ] }, { parent_id: 'parent2', child_contexts: [ { child_id: 'parent2-child1' }, { ...
JavaScript
({})
JavaScript
({ inner: [{ foo: 'foo', inner: [{ bar: 'bar' }] }] })
JavaScript