Skip to content

Instantly share code, notes, and snippets.

View recursion.java
// mutable i
//
int i = 0;
while (something() > 0) {
i++;
}
// immutable i
//
View russian.el
(defun reverse-input-method (input-method)
"Build the reverse mapping of single letters from INPUT-METHOD."
(interactive
(list (read-input-method-name "Use input method (default current): ")))
(if (and input-method (symbolp input-method))
(setq input-method (symbol-name input-method)))
(let ((current current-input-method)
(modifiers '(nil (control) (meta) (control meta))))
(when input-method
(activate-input-method input-method))
View my.html
<meta name='yandex-verification' content='71593b225aeafc4e' />
<meta name='referrer' content='unsafe-url' />
<meta name="pocket-site-verification" content="ed24b2b9721edf0a282c5b4a3232c4" />
View gist:22b7802308df856d2d878e8427b22334
public List<UserDto> fetchUserList(final HttpServletRequest httpServletRequest) {
return CollectionUtils.doMap( usersService.fetchUsersListByName( httpServletRequest.getParameter("name")
, null
, PaginationExtractor.extract(httpServletRequest))
, User::toDto);
}
View gist:b267b6ead30d6b0766a5996555f7936a
public Person mainFlow(String arg1, String arg2, int arg3) throws WrongArgs, WrongPerson, WrongResult {
verifyArgs(arg1, arg2, arg3);
Person p = personRepo.readFromDb( arg3 );
verifyPerson(p);
Result result = doSomething(arg1, arg2, p);
checkResult( result );
return p;
View gist:d7f8a0dde0d1e543c430f5627bf16627
let result <- runMaybeT $ do Engine.boost.quick_fetch [Foam Beer_opener Lighter_gun]
send_to Defender.closest.dear
append $ hugs <> kisses
say "Hurrah!"
View gist:56722ef538c99233788e405c4a1eefbd
class Counter {
private int count = 10;
public void increment() {
count = count + 1;
}
public void decrement() {
count = count - 1;
}
View gist:7fc018ad6565a60a14c95a53118b95b2
// Было
public class QueryParams {
...
public List<Query> queries() {
return Collections.unmodifiableList( values.stream()
.map( item -> item.accept(visitor))
.collect( Collectors.toList() )
);
}
}
View search.el
;; Поиск вперед
(global-set-key (kbd "M-;") 'isearch-forward)
;; Поиск назад
(global-set-key (kbd "M-:") 'isearch-backward)
;; В режиме поиска добавляем несколько клавиш:
;; M-; -- повторить поиск вперед
;; M-: -- повторить поиск назад
;; M-v -- вставить скопированный текст
View taskrunner.clj
(task update-version
"Updates version of the software"
(start [:shell (str *src-dir* "update-version.sh")])
(stop :kill))
(task run-zookeeper
"Runs zookeeper"
(depends-on update-version)
(start [:shell (str *base-dir* "bin/zookeeper.sh")]
[:finish-when :stdout :regexp "\\.started\\."])