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 query-optim.core | |
(:require [clojure.spec :as s] | |
[clojure.spec.gen :as gen] | |
[clojure.string :refer [starts-with?]] | |
[clojure.test.check.generators :as generators])) | |
(s/def ::query | |
(s/cat :find-spec ::find-spec | |
:with-clause (s/? ::with-clause) |
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
WITH RECURSIVE ancestors(id, name, created_at, updated_at) AS ( | |
SELECT categories.id, categories.name, categories.created_at, categories.updated_at | |
FROM categories, categorizations | |
WHERE categorizations.subcategory_id = '667C9DF5-48C0-496B-922A-1B7D743B1A39' | |
AND categories.id = categorizations.category_id | |
UNION ALL | |
SELECT categories.id, categories.name, categories.created_at, categories.updated_at | |
FROM categories, categorizations, ancestors | |
WHERE categorizations.subcategory_id = ancestors.id | |
AND categories.id = categorizations.category_id |
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 categories.core | |
(:require [datomic.api :as d])) | |
(let [uri (str "datomic:mem://" (gensym)) | |
conn (and (d/create-database uri) (d/connect uri))] | |
@(d/transact conn [{:db/id #db/id[:db.part/db] | |
:db/ident :category/name | |
:db/valueType :db.type/string | |
:db/cardinality :db.cardinality/one |
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
begin | |
require 'bundler/inline' | |
rescue LoadError => e | |
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler' | |
raise e | |
end | |
gemfile(true) do | |
source 'https://rubygems.org' | |
gem 'rails', github: 'rails/rails' |
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 dropwarlock.reducers) | |
(defprotocol Reducee | |
(reduce-with-instructions [this inst f])) | |
(extend-protocol Reducee | |
clojure.lang.PersistentVector | |
(reduce-with-instructions [this [action acc] f] | |
(case action | |
:cont (if (empty? this) |
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
#!/usr/bin/env python | |
DOCUMENTATION = ''' | |
--- | |
module: bugsnag_deployment | |
short_description: Notifies Bugsnag of deploys. | |
options: | |
api_key: | |
description: | |
- The API Key associated with the project. Informs Bugsnag which project |
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
Run options: --seed 53381 | |
# Running: | |
. | |
Finished in 0.000873s, 1145.2393 runs/s, 1145.2393 assertions/s. | |
1 runs, 1 assertions, 0 failures, 0 errors, 0 skips |
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 Optional | |
private_class_method :new | |
def self.maybe(possible) | |
possible.nil? ? absent : of(possible) | |
end | |
def self.absent | |
None.new | |
end |
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 'active_record' | |
require 'logger' | |
ActiveRecord::Base.establish_connection adapter: 'sqlite3', database: ':memory:' | |
ActiveRecord::Base.connection.instance_eval do | |
create_table(:starting_goalies) do |t| | |
t.string :status | |
end | |
end |
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 | |
set -e | |
cp previous.key intermediate.key | |
cp current.key previous.key | |
mv intermediate.key current.key | |
service nginx reload |