It's now here, in The Programmer's Compendium. The content is the same as before, but being part of the compendium means that it's actively maintained.
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
| /** Users of your module possibly never need interfaces in this namespace. But you will. */ | |
| export namespace Configuration { | |
| /** Configuration defaults -> all of these keys are optional for users of your module. */ | |
| export interface Defaults { | |
| /** If set to true, my module will always fail. Default = false */ | |
| alwaysFail: boolean; | |
| } | |
| /** Required configuration options, no defaults are used here */ |
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
| !! | |
| !! Implementation of JSONPatch (http://jsonpatch.com/) using PostgreSQL >= 9.5 | |
| !! | |
| CREATE OR REPLACE FUNCTION jsonb_copy(JSONB, TEXT[], TEXT[]) RETURNS JSONB AS $$ | |
| DECLARE | |
| retval ALIAS FOR $1; | |
| src_path ALIAS FOR $2; | |
| dst_path ALIAS FOR $3; | |
| tmp_value JSONB; |
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 '[schema.core :as s]) | |
| (require '[schema.coerce :as coerce]) | |
| (require '[schema.utils :as utils]) | |
| (defn filter-schema-keys | |
| [m schema-keys extra-keys-walker] | |
| (reduce-kv (fn [m k v] | |
| (if (or (contains? schema-keys k) | |
| (and extra-keys-walker | |
| (not (utils/error? (extra-keys-walker k))))) |
Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.
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
| ;;; skewer-coffee.el --- skewer support for live-interactive Coffeescript | |
| (defun skewer-coffee-eval (coffee-code) | |
| "Requests the browser to evaluate a coffeescipt string." | |
| ;; XXX should escape double quote characters | |
| (skewer-eval (concat "CoffeeScript.eval(\"" | |
| (s-replace "\n" "\\n" (s-trim coffee-code)) | |
| "\");") | |
| #'skewer-post-minibuffer)) |
A list of tools mentioned in my Ignite talk from Devopsdays Rome 2012 on a continuous packaging pipeline, with links and short description for each tool.
The talk slides are at https://speakerdeck.com/mpasternacki/a-continuous-packaging-pipeline; a longer blog post will be written soon.
Available at https://github.com/3ofcoins/vendorificator/ or with gem install vendorificator
Include third party modules in your git repo, using pristine branches to sanely maintain local changes, upgrades, and merges.
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
| -- show running queries (pre 9.2) | |
| SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
| FROM pg_stat_activity | |
| WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
| ORDER BY query_start desc; | |
| -- show running queries (9.2) | |
| SELECT pid, age(clock_timestamp(), query_start), usename, query | |
| FROM pg_stat_activity | |
| WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
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
| Vagrant::Config.run do |config| | |
| # ... | |
| config.vm.customize ["modifyvm", :id, "--natdnshostresolver1", "on"] | |
| end |
NewerOlder