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
# example function | |
def f | |
[:ok, 'bla bla'] | |
end | |
# | |
# elixir-like offensive matching (match or exception) | |
# | |
# success case |
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
##################################################################################### | |
####### Benchmarking infrastructure (no significant busuness logic involved) ####### | |
##################################################################################### | |
####### Naive PORO realization | |
Warming up -------------------------------------- | |
NativeNaive [prepared] |
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
;; -*- mode: emacs-lisp -*- | |
;; This file is loaded by Spacemacs at startup. | |
;; It must be stored in your home directory. | |
(defun dotspacemacs/layers () | |
"Configuration Layers declaration. | |
You should not put any user code in this function besides modifying the variable | |
values." | |
(setq-default | |
;; Base distribution to use. This is a layer contained in the directory |
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
HeavyControl.config do | |
ignore_subfolder 'operation' | |
ignore_subfolder 'operations' | |
# when you face error warning like 'warning: toplevel constant YourClass referenced by YourContext::YourClass' | |
# just add 'YourContext::YourClass' to always_load | |
always_load 'Organization::Admin', 'Organization::Cell', | |
'Course::Admin', 'Course::Cell' | |
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
func flattenSlice(input *[][]interface{}) *[]interface{} { | |
capSum := 0 | |
for _, v := range *input { | |
capSum += cap(v) | |
} | |
result := make([]interface{}, 0, capSum) | |
for _, v := range *input { | |
result = append(result, v) | |
} | |
return &result |
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
# use only for possible transitions check | |
class IndividualWebinar::Workflow | |
include Statesman::Machine | |
def initialize(webinar) | |
@webinar = webinar | |
end | |
state :planned | |
state :waiting_for_teacher |
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
HeavyControl.config do | |
root :concepts do # all stuff loaded in recursive lexicographical order, deep files last | |
common do | |
no_scope :operations # concepts/aaa/operations/bbb.rb will be pointed to Aaa::Bbb instead of Aaa::Operations::Bbb | |
# it's like we move all files out of operations folder | |
prioritize_file :policy # will load policy.rb before any other files and directories in folder | |
prioritize_folder :generators # will load generators folder before any other files and directories in folder, except :policy | |
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
# Your init script | |
# | |
# Atom will evaluate this file each time a new window is opened. It is run | |
# after packages are loaded/activated and after the previous editor state | |
# has been restored. | |
# | |
# An example hack to log to the console when each text editor is saved. | |
# | |
# atom.workspace.observeTextEditors (editor) -> | |
# editor.onDidSave -> |
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
require 'benchmark' | |
require 'active_support' | |
module Hello | |
extend ActiveSupport::Concern | |
BENCH_ITERS = 1_000_000 | |
included do | |
double_method :hello_double, :hello |
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
object Problem1001 { | |
def main(args: Array[String]) { | |
val numbersStrings = io.Source.stdin.getLines() | |
val squares = numbersStrings.flatMap { | |
_.split(" ").filterNot { _.isEmpty }.map { x => math.sqrt(x.toLong) } | |
}.toArray.reverse | |
println(squares.mkString("\n")) | |
} | |
} |
NewerOlder