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
<link rel="import" href="../core-icon-button/core-icon-button.html"> | |
<link rel="import" href="../core-toolbar/core-toolbar.html"> | |
<link rel="import" href="../core-scroll-header-panel/core-scroll-header-panel.html"> | |
<polymer-element name="signup-dialog"> | |
<template> | |
<style> | |
:host { | |
position: absolute; |
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
% Purpose: I use this pre-commit hook to mark objects in a bucket as "dirty" with secondary indexing. | |
% I then use a script to scrape out all dirty objects, do some processing, then save them with | |
% "dirty_bin = false" as an index and the pre-commit hook erases the "dirty_bin" index. | |
% So in essence it works as: `if dirty_bin = false; del dirty_bin; else dirty_bin = true; end` | |
% | |
% To install this pre-commit hook (just like any Riak pre-commit hook in Erlang), you need to create an Erlang file and | |
% put it in your "basho-patches" directory. For me, on Ubuntu, this was "/usr/lib/riak/lib/basho-patches". | |
% Once there, you need to compile it to a .beam file. This was helped by using the Riak provided erlc compiler, | |
% which, on my Ubuntu system, was at "/usr/lib/riak/erts-5.8.5/bin/erlc" | |
% |
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
class get_item(object): | |
def __init__(self, d, i): | |
self.d = d | |
self.i = i | |
def __enter__(self): | |
if self.i in self.d: | |
return self.d[self.i] | |
return None |
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 zero-for-count | |
"A sliding window of the last n events, emitting an event when all are zero." | |
[n & children] | |
(let [window (ref (vec (repeat n nil)))] | |
(fn [event] | |
(dosync (alter window pop) | |
(ref-set window (into [(:metric event)] @window))) | |
(when (every? (fnil zero? 1) @window) | |
(call-rescue | |
(assoc event :description (str "Last " n " metrics have been zero!") :state "warning") |
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 sum-for-count | |
"Emit the sum of the last n events." | |
[n & children] | |
(let [window (ref (vec (repeat n 0)))] | |
(fn [event] | |
; here we guard against putting nils in our vector which doesn't work with (reduce + ... ) | |
(if (and (contains? event :metric) | |
(not (nil? (:metric event)))) | |
(do | |
(dosync (alter window pop) |