View flipper-moneta-performance.rb
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
require 'moneta' | |
require 'flipper' | |
load './lib/flipper/adapters/moneta.rb' | |
moneta = Moneta.build do | |
use :Logger | |
adapter :Memory | |
end | |
adapter = Flipper::Adapters::Moneta.new(moneta) |
View content-type.rb
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
content_type = request["content-type"] |
View open.rb
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
require 'gruff' | |
g = Gruff::Line.new(400) | |
g.maximum_value = 100 | |
g.minimum_value = 0 | |
g.y_axis_increment = 5 | |
g.theme = { | |
:colors => %w(black red), | |
:marker_color => 'grey', | |
:font_color => 'black', |
View mixin.rb
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
module Request | |
HEADERS = { 'Content-Type' => 'application/json' }.freeze | |
def self.add_headers(headers) | |
HEADERS.merge!(headers) | |
end | |
def get_request(path) | |
uri = URI.parse(path) | |
http = Net::HTTP.new(uri.host, uri.port) |
View clj.clj
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
(defn- copy-nil-vals [[k v]] | |
(if (nil? v) | |
{k k} | |
{k v})) | |
(defn column-vals [column-mappings] | |
(->> column-mappings | |
(map #(select-keys % [:value :mapped_value])) | |
(map vals) | |
(map #(apply hash-map %)) |
View a_list.sql
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
WITH RECURSIVE tree AS ( | |
SELECT id, ARRAY[]::INTEGER[] AS ancestors | |
FROM test WHERE parent_id IS NULL | |
UNION ALL | |
SELECT test.id, tree.ancestors || test.parent_id | |
FROM test, tree | |
WHERE test.parent_id = tree.id |
View code.clj
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
;; project.clj | |
... | |
:dependencies [[org.clojure/clojure "1.8.0"] | |
[clj-ssh "0.5.14"]] | |
(ns csv-loader.csv | |
(:require [clj-ssh.ssh :as ssh])) | |
View public.rb
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
class Foo | |
def baz | |
log("some msg") | |
2 | |
end | |
def bar(n) | |
n + baz | |
end |
View gist:6aea1293a59b74d2472b59a6e565ac08
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
def m | |
enum = [1,2,3].each | |
loop do | |
enum.next | |
end | |
end | |
# m returns [1,2,3] | |
View gist:2e30e272bc2dfacb63711ffed3626111
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
<div id="player">Click ME FRITZ</div> | |
<script> | |
$(document).ready(function() { | |
player = new Audio("img/songs/test.mp3"); | |
$('#player').click(function(){ | |
player.play(); | |
} | |
}); | |
</script> |
NewerOlder