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
# encoding: utf-8 | |
require 'quantum_lead/application' | |
require 'singleton' | |
require 'logger' | |
require 'version' | |
require 'couchrest' | |
require 'java' | |
java_import 'java.util.concurrent.ConcurrentLinkedQueue' | |
class Database |
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 'java' | |
java_import 'java.util.concurrent.Executors' | |
java_import 'java.util.concurrent.TimeUnit' | |
module Enumerable | |
# From activesupport/lib/active_support/core_ext/enumerable.rb | |
def sum(identity = 0, &block) | |
if block_given? | |
map(&block).sum(identity) | |
else |
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
#!/bin/bash | |
# | |
# This script clears out all the "stale" jars that we no longer need. | |
# They have to be AT LEAST 30 days old, and we MUST keep the last 5. | |
# Other than that, they can go. | |
# | |
# | |
# Set upt he environment for this - as we do in all scripts |
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
<html> | |
<head> | |
<title>Dark Magic Query Tools for Quantum Lead</title> | |
<link href='//fonts.googleapis.com/css?family=Ubuntu' rel='stylesheet' type='text/css'> | |
<script type='text/javascript' src='zingchart/resources/jquery.min.js'></script> | |
<script type='text/javascript'> | |
// This is a clever little function I found that does a very simplistic | |
// syntax coloring scheme for JSON. What it really is doing is to classify | |
// all the elements, and then with CSS we can color them. Very slick. | |
function syntaxHighlight(json) { |
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
create or replace function locations_for_demand_set(ds_id uuid) | |
returns table(id uuid, | |
demand_id uuid, | |
is_anchor_zip boolean, | |
latitude double precision, | |
longitude double precision, | |
name varchar, | |
subdivision_rank varchar, | |
type varchar, | |
division_permalink varchar, |
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
dark-magic.main=> (require 'slam :reload-all) | |
nil | |
dark-magic.main=> (slam/unbound 4) | |
nil | |
dark-magic.main=> (slam/bound 4) | |
nil |
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
(ns performance.server | |
"The routes for the web server." | |
(:require [cheshire.core :as json] | |
[clj-time.core :refer [now]] | |
[clojure.tools.logging :refer [infof warn warnf error errorf]] | |
[compojure | |
[core :refer [defroutes GET POST]] | |
[handler :as handler]] | |
[ring.middleware.jsonp :refer [wrap-json-with-padding]] | |
[ring.middleware.params :refer [wrap-params]] |
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
(ns gym.storm.nimbus | |
"Namespace for exercising Nimbus to find out facts about the specific storm | |
cluster. This data can be used to monitor the cluster and look at stats in | |
a way that's got very low load on the overall system." | |
(:require [backtype.storm.clojure :refer :all] | |
[backtype.storm.config :refer :all] | |
[backtype.storm.ui.core :refer :all] | |
[clj-endpoints :as ep] | |
[clj-endpoints.persistence.redis :refer [wcar]] | |
[clj-endpoints.util :as util] |
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
(ns finch-experiments.bucket | |
"Namespace to deal with all the bucketing issues with the experiments and | |
users so that we can respond as the finch client would." | |
(:require [clj-endpoints :as ep] | |
[clj-endpoints.logging :refer [log-execution-time!]] | |
[clj-endpoints.util :refer [md5 to-uuid nil-if-empty compact]] | |
[finch-experiments.routing :as routing] | |
[finch-experiments.web :as web] | |
[finch-experiments.data :refer [experiment-list]])) |
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
(defn return-json | |
"Creates a ring response for returning the given object as JSON." | |
([ob] (return-json ob (now) 200)) | |
([ob lastm] (return-json ob lastm 200)) | |
([ob lastm code] | |
{:status code | |
:headers {"Content-Type" "application/json; charset=UTF-8" | |
"Last-Modified" (str (or lastm (now)))} | |
;; TODO: the input-stream tactic is foiled by ring.middleware.jsonp | |
;; which slurps the whole stream before adding the callback. Could |