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
MongoidClass.collection.find(param1: 'blablab', param2: 'blablabla').upsert("$set" => hash_with_additional_opts) |
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
=Navigating= | |
visit('/projects') | |
visit(post_comments_path(post)) | |
=Clicking links and buttons= | |
click_link('id-of-link') | |
click_link('Link Text') | |
click_button('Save') | |
click('Link Text') # Click either a link or a button | |
click('Button Value') |
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
i_need_name :matrix_name do | |
:m1 + :m2[+1,-1] + (:m3 * :m4)[+1, 0] | |
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
module MetaCL | |
module Error | |
class MetaCLError < StandardError; end | |
{ | |
# matrices errors | |
MatrixUnknownElementType: 'Cannot define matrix: unknown element type', | |
MatrixInvalidSizeParams: 'Cannot define matrix: invalid size params', | |
MatrixNameDuplication: 'Cannot define matrix: matrix with same name already exists', | |
MatrixNotFound: 'Cannot find matrix with given name', # TODO: what name? |
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
#include <stdlib.h> | |
#include <stdio.h> | |
int main() | |
{ | |
float *a = malloc(100 * sizeof(float)); // N = 10, M = 10 | |
for (int i = 0; i < 100; i++) { | |
a[i] = 1; | |
} | |
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
configure do | |
lang :c | |
end | |
create_matrix :a, :float, 10, 10, fill_with: 1 | |
create_matrix :b, :float, 10, 10, fill_with: 2 | |
create_matrix :c, :float, 10, 10, fill_with: 3 | |
create_matrix :d, :float, 10, 10, fill_with: 4 | |
create_matrix :result, :float, 10, 10 |
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
<%= simple_form_for @product do |f| %> | |
<%= f.simple_fields_for :attributes do |d| %> | |
<% f.object.attributes.try(:each) do |key, value| %> | |
<%= d.input key, :input_html => {:value => value } %> | |
<% end %> | |
<% end %> | |
<% 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
object Problem1001 extends App { | |
val numbersStrings = io.Source.stdin.getLines() | |
for { | |
x <- numbersStrings.flatMap { | |
_.split(" ").filterNot { _.isEmpty }.map { x => math.sqrt(x.toDouble) } | |
}.toList.reverse | |
} yield println(f"$x%.04f".replace(',', '.')) | |
} |
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")) | |
} | |
} |
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 |
OlderNewer