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
# 1. Install nginx | |
brew install nginx | |
# 2. Generate self-signed key/crt | |
openssl req -x509 -nodes -days 365 -newkey rsa:1024 \ | |
-keyout /etc/ssl/private/myssl.key \ | |
-out /etc/ssl/certs/myssl.crt | |
# 3. Edit nginx config located at: /usr/local/etc/nginx/nginx.conf | |
server { |
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) |
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"] |
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', |
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) |
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 %)) |
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 |
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])) | |
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 |
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] | |
NewerOlder