Коллега генерировал pdf c помощью latex, а для подстановки переменных в шаблон использовал erb. Ну и огорчался конечно, что ни подсветка синтаксиса не работает, ни автодополнение. И тут мне стало интересно. Поэтому с помощью библиотеки Polymode был изготовлен режим для emacs, который внутри erb-блоков включал ruby-mode со всеми плюшками, а на всем остальном тексте работал как latex-mode.
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
module ApplicationHelper | |
def button_destroy(object) | |
link_to_destroy(object, class: 'btn btn-default') | |
end | |
def button_destroy_small(object) | |
link_to_destroy(object, class: 'btn btn-default btn-xs') | |
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
True=False | |
print True # => False | |
if True: | |
print "boring..." | |
else: | |
print "wait, what?!" | |
# => wait, what?! |
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
;; Когда ты нажимаешь на кнопку в первый раз, выполняется функция, | |
;; которая делает то, что ей положено (в этом примере - начинает | |
;; записывать макрос) и переопределяет клавишу по которой была | |
;; вызвана функция на другую функцию (в этом примере - остановка записи | |
;; макроса). | |
(defun toggle-kbd-macro-recording-on () | |
"One-key keyboard macros: turn recording on." | |
(interactive) | |
(define-key global-map (this-command-keys) ; <= HERE |
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
#!/bin/sh | |
issue_id=$(git rev-parse --abbrev-ref HEAD | grep --only-matching -P '^\d+') | |
if [ -n "$issue_id" ]; then | |
echo "Связано c #$issue_id" >> $1 | |
fi | |
exit 0 |
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
# Run like this: | |
# what_have_i_done 2015-12-01 | |
function what_have_i_done { | |
cd /opt/redmine/plugins/ | |
DATE=$1; | |
NAME=$(git config --global user.name); | |
for repo in $(find . -maxdepth 1 -type d); | |
do | |
echo $repo; |
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
# Прикольное форматирование. Мне нравилось в два столбца | |
# логи писать параллельно с кодом (за это меня все ненавидели), | |
# а тут на уровне синтаксиса языка. | |
(1..10) .tap {|x| puts "original: #{x.inspect}"} | |
.to_a .tap {|x| puts "array: #{x.inspect}"} | |
.select {|x| x%2==0} .tap {|x| puts "evens: #{x.inspect}"} | |
.map { |x| x*x } .tap {|x| puts "squares: #{x.inspect}"} | |
# via http://ruby-doc.org/core-2.1.1/Object.html |
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
!! /usr/share/themes/#{your theme}/openbox-3/themerc | |
border.width: 1 | |
border.color: #000 | |
window.active.border.color: #000 | |
window.inactive.border.color: #000 |
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
(setq url-proxy-services | |
'(("http" . "ip:port") | |
("https" . "ip:port"))) | |
(setq url-http-proxy-basic-auth-storage | |
(list (list "ip:port" | |
(cons "Input your LDAP UID !" | |
(base64-encode-string "login:pass"))))) | |
# via some good guys from stackoverflow |
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
# Для тестирования было нужно много pdf, различающихся хеш-суммой. | |
# Скрипт внизу через fuse создает папку с одним виртуальным файлом. | |
# Каждый раз, когда кто-то обращается к файлу, скрипт вычисляет что | |
# он отдаст. В моем случае это тупо врем десять раз, потому что мне | |
# достаточно чтобы просто хеши у файлов разные были. | |
# | |
# Это просто немного исправленный hello world из примеров работы с | |
# гемом, но полезно, да. | |
require 'rfusefs' |
OlderNewer