String split 1 million line string from Heroku log file:
- Elixir 166s
- Clojure 8s
- Ruby 1s
- Python 0.5s
(require '[schema.core :as s]) | |
(def StrOrKeyword (s/cond-pre s/Str s/Keyword)) | |
(declare Schema) | |
(declare SchemaValue) | |
(def SchemaMap {s/Keyword (s/recursive #'SchemaValue)}) | |
(def SchemaArray [(s/recursive #'SchemaValue)]) | |
(def SchemaValue (s/cond-pre s/Str s/Num Nil s/Bool SchemaMap SchemaArray)) | |
(def SchemaType (s/enum "string" "number" "integer" "null" "boolean" "array" "object")) |
# NOTE: There must be a better way to do this - help appreciated! | |
############################################################### | |
# uploaded_file.rb - utility class | |
############################################################### | |
class UploadedFile | |
def self.size(file) | |
uploaded?(file) ? file.size : nil | |
end |
################################################################ | |
# config/initializers/handlebars.rb: | |
################################################################ | |
template_path = File.join(Rails.root.to_s, 'app/views') | |
helpers = { | |
t: lambda do |context, key| | |
I18n.t(key) | |
end, | |
path: lambda do |context, path_name| |
Java:
public Optional<String> getType() {
return this.types.isEmpty() ?
Optional.empty() :
Optional.of(String.join(",", (Iterable)this.types.stream().map(Enum::name).collect(Collectors.toList())));
}
const R = require('ramda') | |
function pathString(path: string[]): string { | |
return path.join('.') | |
} | |
function valueType(value: any): string { | |
if (value === undefined) { | |
return 'undefined' | |
} else if (value === null) { |
{ | |
"compilerOptions": { | |
"target": "es5", | |
"module": "commonjs", | |
"moduleResolution": "node", | |
"sourceMap": true, | |
"emitDecoratorMetadata": true, | |
"experimentalDecorators": true, | |
"lib": [ "es2015", "dom" ], | |
"noImplicitAny": true, |
{ | |
"editor.fontSize": 14, | |
"editor.tabSize": 2, | |
"editor.detectIndentation": false, | |
"editor.insertSpaces": true, | |
"files.trimTrailingWhitespace": true, | |
"files.exclude": { | |
"**/.git": true, | |
"**/.svn": true, | |
"**/.hg": true, |
# Running a single minimalistic unit test with Rails 4 and Ruby 2.1.1 is a lot faster | |
# if you avoid loading Rails: | |
# Running the test *with* Rails | |
time ruby -Itest test/models/my_model_test.rb # => real ~ 6s | |
# Running the test *without* Rails | |
time ruby -Itest/no_rails test/models/my_model_test.rb # => real ~ 0.6s |