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
(defmacro l10 [& body] | |
(doseq [i (range 10)] | |
`(println 1))) | |
(macroexpand `(l10 (println 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
(cmd-hook #"meme" | |
#"^popular$" (chat-instance-popular) | |
#"^trending$" (chat-meme-list | |
(gen-trending)) | |
#"^search\s(.+)" (chat-meme-list | |
(search-generators (second p))) | |
#"(\w+)\s(.+)\/(.+)$" (chat-instance | |
(create-instance | |
(map-to-query-string | |
(build-instance-params |
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
mysql 5.5.15 | |
http://dev.mysql.com/doc/refman/5.5/en/ | |
Depends on: cmake, readline, pidof | |
/usr/local/Cellar/mysql/5.5.15 (6276 files, 217M) | |
Set up databases to run AS YOUR USER ACCOUNT with: | |
unset TMPDIR | |
mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp | |
To set up base tables in another folder, or use a different user to run |
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
(defn meme-hook [callback cmd args] | |
(if (re-find #"meme" (s/lower-case cmd)) | |
(cond-let [p] | |
(re-find #"^popular$" args) (chat-instance-popular) | |
(re-find #"^trending$" args) (chat-meme-list | |
(gen-trending)) | |
(re-find #"^search\s(.+)" args) (chat-meme-list | |
(search-generators (second p))) | |
(re-find #"(\w+)\s(.+)\/(.+)$" args) (chat-instance | |
(create-instance ; e.g. "meme yuno line1 / line2" |
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
:&javascript | |
function foo(a) { console.log(a); } | |
- for(i <- 1 to 10) | |
:&javascript | |
foo(#{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
(defn chat-status [job-name] | |
"Sends job status info to chat. Sample output: | |
SUCCESS at Wed Nov 16. Started by trevor. | |
Currently building? false | |
Show 6 rumors before truncating" | |
(let [json (status job-name)] | |
(println json) | |
(if-let [building (str (:building json))] ; convert to string so a `false` doesn't give a false-negative | |
(let [result (str (:result json)) | |
changeset (s/join |
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
- for (((url, source), i) <- similarSources.toSeq.zipWithIndex) | |
a(href="#{url}" target="_blank")><= source | |
span>< | |
- if (i < (similarSources.size - 2)) | |
| , | |
- else if (i == (similarSources.size - 2)) | |
| and |
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
$('#local_prices_page_contents') | |
.html( | |
(offers.size() > 0) ? | |
($.mustache(localPricesTemplate, {offers: offers.toJSON()})) : | |
""); |
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 brackets_valid?(str) | |
open = [] | |
matches = { '{' => '}', '(' => ')', '[' => ']' } | |
str.split('').each do |c| | |
if matches.keys.include? c # it's an opening bracket | |
open.push c | |
elsif matches.values.include? c # it's a closing bracket | |
# must close the last open bracket | |
return false unless c == matches[open.pop] |
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
" Put default register into system clipboard | |
nnoremap <leader>yc :let @+=@"<cr> | |
" Put system clipboard into default register | |
nnoremap <leader>cy :let @"=@+<cr> |