-
This is a numbered list.
-
I'm going to include a fenced code block as part of this bullet:
Code More Code
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
# Helper functions that allow string arguments for dplyr's data modification functions like arrange, select etc. | |
# Author: Sebastian Kranz | |
# Examples are below | |
#' Modified version of dplyr's filter that uses string arguments | |
#' @export | |
s_filter = function(.data, ...) { | |
eval.string.dplyr(.data,"filter", ...) | |
} |
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 get_count(q): | |
count_q = q.statement.with_only_columns([func.count()]).order_by(None) | |
count = q.session.execute(count_q).scalar() | |
return count | |
q = session.query(TestModel).filter(...).order_by(...) | |
# Slow: SELECT COUNT(*) FROM (SELECT ... FROM TestModel WHERE ...) ... | |
print q.count() |
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
# Memory snapshot analyzer which parses the /proc file system on *nix | |
# | |
# Example (run in Heroku console): | |
# | |
# ms = MemorySnapshot.new | |
# 1.upto(10000).map { |i| Array.new(i) }; nil | |
# ms.snapshot!; nil | |
# ms.diff 10 | |
# => {"lib/ld-2.11.1.so"=>156, "heap"=>2068, "all"=>2224} | |
# |
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
Navigation: | |
cmd-p Goto Anything ('@' for functions, ':' for line number) | |
cmd-r Function finder | |
ctl-g Goto line number | |
cmd-sft-p Command palette | |
cmd-sft-f Find in Files | |
cmd-opt-r Toggle regex when finding | |
cmd-opt-# Columns | |
ctr-# Switch columns |