Skip to content

Instantly share code, notes, and snippets.

View v-kolesnikov's full-sized avatar
✍️
I'm writing something just now! You can write me too! 😉

Vasily Kolesnikov v-kolesnikov

✍️
I'm writing something just now! You can write me too! 😉
View GitHub Profile

Конфиги

Навигация

Различные способы перехода в режим вставки

i " вставить текст до курсора
@mokevnin
mokevnin / Dockerfile
Last active January 27, 2016 15:01
python handler for battle.hexlet.io
FROM hexlet/hexlet-base
RUN apt-install python-pip python-dev
RUN apt-install python3-pip python3-dev
RUN pip3 install pytest
ENV PYTHONDONTWRITEBYTECODE 1
@v-kolesnikov
v-kolesnikov / 00_destructuring.md
Created February 6, 2016 17:28 — forked from john2x/00_destructuring.md
Clojure Destructuring Tutorial and Cheat Sheet

Clojure Destructuring Tutorial and Cheat Sheet

(Related blog post)

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.

Vectors

@v-kolesnikov
v-kolesnikov / y_combinator.clj
Last active August 12, 2016 18:12
Y-Combinator
(defn factorial [n]
(let [y (fn [f] (f f))
f (fn [g] (fn [n] (if (zero? n) 1 (* n ((g g) (dec n))))))]
((y f) n)))
@flash-gordon
flash-gordon / env_validation.rb
Created September 18, 2016 10:14
ENV validation POC
require 'dry-validation'
class EnvValidation
class ENV
def inspect
ivs = instance_variables.each { |v| "#{v}=#{instance_variable_get(v)}" }.join(', ')
"ENV[#{ivs}]"
end
def to_s
@ahoy-jon
ahoy-jon / small-Y.clj
Last active April 22, 2017 05:37
Small and pluggable Y combinator in clojure.
;; ; made this macro scraching my head between the simplicity of Haskell for fix
;; ; and the absence of curryfication in Clojure.
;; (P expr-fn) ; makes expr-fn lazy
;; (P P expr-fn) ; curry one time expr-fn
;; (P P P expr-fn) ; curry two time expr-fn
;; (= ((((P P P str) "a") "b") "c") "abc") ;=> true
(defmacro P [& f]
(let [x (gensym 'x)] ;; cannot be replaced by x# due to nested macro expansion.
class Jobs < ROM::Relation[:sql]
schema(:jobs) do
# ...
associations do
belongs_to :team
belongs_to :template
belongs_to :address
belongs_to :client
end
/**
* @brief executeQueriesFromFile Read each line from a .sql QFile
* (assumed to not have been opened before this function), and when ; is reached, execute
* the SQL gathered until then on the query object. Then do this until a COMMIT SQL
* statement is found. In other words, this function assumes each file is a single
* SQL transaction, ending with a COMMIT line.
*/
void executeQueriesFromFile(QFile *file, QSqlQuery *query)
{
@adam12
adam12 / context.yml
Last active May 23, 2019 07:37 — forked from thinkerbot/context.yml
ERB vs Erubis vs Erubi
list:
- name: Adobe Systems
name2: Adobe Systems Inc.
url: http://www.adobe.com
symbol: ADBE
price: 39.26
change: 0.13
ratio: 0.33
- name: Advanced Micro Devices
name2: Advanced Micro Devices Inc.
#%RAML 0.8
title: World Music API
baseUri: http://example.api.com/{version}
version: v1
schemas:
- halLink: |
{ "$schema": "http://json-schema.org/schema",
"type": "object",
"description": "a Hypertext Application Language link",