This file contains 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
/* Extend the Underscore object with the following methods */ | |
// Rate limit ensures a function is never called more than every [rate]ms | |
// Unlike underscore's _.throttle function, function calls are queued so that | |
// requests are never lost and simply deferred until some other time | |
// | |
// Parameters | |
// * func - function to rate limit | |
// * rate - minimum time to wait between function calls | |
// * async - if async is true, we won't wait (rate) for the function to complete before queueing the next request |
This file contains 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
If you don't care about the return value of the IIFE, it could also be any of the following: | |
!function(){}(); // => true | |
~function(){}(); // => -1 | |
+function(){}(); // => NaN | |
-function(){}(); // => NaN | |
Let's explore this a bit more. | |
// module1.js | |
(function() { |
This file contains 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 () { | |
var $input = $('#testcemo'); | |
$input.typeahead({ | |
source: function (query, process) { | |
return $.getJSON('/mybackoffice/demo/user', { query: query }, function (data) { | |
var val = $input.data("typeahead-ajax-val"), | |
id = $input.data("typeahead-ajax-id"), | |
mapped = {}, | |
labels = [] |
This file contains 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
/** | |
* Cloud Foundry 2012.02.03 Beta | |
* Copyright (c) [2009-2012] VMware, Inc. All Rights Reserved. | |
* | |
* This product is licensed to you under the Apache License, Version 2.0 (the "License"). | |
* You may not use this product except in compliance with the License. | |
* | |
* This product includes a number of subcomponents with | |
* separate copyright notices and license terms. Your use of these | |
* subcomponents is subject to the terms and conditions of the |
This file contains 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
package ecc.dashboard.persistent.repository; | |
import java.lang.reflect.Field; | |
import java.util.Arrays; | |
import java.util.Collections; | |
import java.util.Date; | |
import java.util.List; | |
import java.util.Map; | |
import java.util.Map.Entry; |
This file contains 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
# Artie - Artie Server | |
# | |
# Real-time messaging service | |
description "artie" | |
start on filesystem | |
stop on runlevel S | |
respawn |
This file contains 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> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-enforcer-plugin</artifactId> | |
<version>1.0.1</version> | |
<dependencies> | |
<dependency> | |
<groupId>magnet.toolchain</groupId> | |
<artifactId>magnet-enforce-plugin-rules-extension</artifactId> | |
<version>1.0-SNAPSHOT</version> | |
</dependency> |
This file contains 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
@WebServlet("/upload") | |
@MultipartConfig(location = "/tmp") | |
public class FileUploadServlet extends HttpServlet { | |
@Override | |
protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { | |
getServletContext().getRequestDispatcher("/WEB-INF/views/fileUpload.jsp").forward(req, res); | |
} | |
@Override |
This file contains 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
description "service" | |
start on filesystem | |
stop on runlevel S | |
respawn | |
respawn limit 10 5 | |
oom never | |
kill timeout 86400 #If it's given a stop order, this is how long it will take to stop. |
This file contains 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
'use strict'; | |
var lrSnippet = require('grunt-contrib-livereload/lib/utils').livereloadSnippet; | |
var mountFolder = function (connect, dir) { | |
return connect.static(require('path').resolve(dir)); | |
}; | |
// # Globbing | |
// for performance reasons we're only matching one level down: | |
// 'test/spec/{,*/}*.js' |