Skip to content

Instantly share code, notes, and snippets.

@jqmtor
jqmtor / actionlist.txt
Created April 10, 2022 10:19
IdeaVim's actionlist
--- Actions ---
$Copy <M-C>
$Cut <M-X> <S-Del>
$Delete <Del> <BS> <M-BS>
$LRU
$Paste <M-V>
$Redo <M-S-Z> <A-S-BS>
$SearchWeb
$SelectAll <M-A>
$Undo <M-Z>
(require '[ring.swagger.swagger2 :as rs])
(require '[schema.core :as schema])
(schema/defschema Person {:age schema/Int})
(defn adult?
[person]
(> (:age person) 17))
(def Adult (schema/constrained Person adult?))
@jqmtor
jqmtor / configurable_gateway.rb
Last active June 1, 2016 16:06
Make URLs more visible in HTTP-based gateways. In HTTP-based gateways, URL visibility is an important feature because it gives the reader a very good idea of the overall functionality of the class. This proposal strives to achieve that goal and was instigated by @tjsousa, who brought the problem up while reviewing some code.
# simple DSL to describe and build URLs in an HTTP gateway
module ConfigurableGateway
def self.included(base)
base.extend(ClassMethods)
end
def url_for(name, params = nil)
# probably should be replaced by an automatic forwarding mechanism
@jqmtor
jqmtor / init_without_new.rb
Last active December 26, 2015 11:49
Initialize object without new
class Team
attr_accessor :name, :country
class << self
undef_method :new
end
def self.constructor(*args)
obj = allocate
obj.send(:initialize, *args)