Строка называется палиндромом если она имеет абсолютно одинаковую последовательность символов с права на лево и слева на право, для примера:
- "kayak",
- "abcba",
- "neven".
Строка A называется анаграммой к строке B если A может быть получена из B путем перестановки символов. Для примера строки из этих пар являются анаграммами к друг другу:
WARNING! This document outdated. See this blog post
Какой угол составляют часовая и минутная стрелка в 3 часа 15 минут?
Давайте взглянем на часы:
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
; remove duplicates from sequence | |
; third | |
(defn compress [seq] | |
(->> seq | |
(reduce #(cond | |
(= %2 (first %1)) %1 | |
:else (conj %1 %2)) | |
nil) | |
(reverse))) | |
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 client_platform | |
case request.env['HTTP_USER_AGENT'] | |
when 'ios-app' | |
:ios | |
when 'droid-app' | |
:android | |
end | |
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
require "zip/zip" | |
# Usage: | |
# directory_to_zip = "/tmp/input" | |
# output_file = "/tmp/out.zip" | |
# zf = ZipFileGenerator.new(directoryToZip, output_file).write | |
class ZipFileGenerator | |
EXCLUDED_ENTRIES = [".", "..", ".git"] | |
def initialize(input_dir, output_file) |
Курс: Урок: Модуль:
i " вставить текст до курсора
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
Wrangling Parentheses | |
The most effective way to edit Clojure code is structurally with paredit.vim, but if you don't have time to learn that, Vim still brings a lot to the table for dealing with all the parentheses in Clojure code. | |
First, obviously, the % motion (:help %) is very useful. In normal mode, put the cursor on an opening or closing paren and you can: | |
Hit % to jump to the matching paren. | |
Hit d% to delete the parens and everything they contain. | |
Hit y% to "yank"/copy the parens and everything in them. | |
Hit c% to delete the parens and the text they contain and start editing. | |
Hit v% to select the parens and the text they contain visually. |
- Dispath vs tslime for rspec
- Quick block convert with blockle conflict to buffergator