# Add remote origin pointing to fork, if it is not added
git remote add origin git@github.com:waterlink/contracts.ruby.git
# Add remote upstream pointing to main repo, if it is not added
git remote add upstream git@github.com:egonSchiele/contracts.ruby.git
# Fetch latest master from upstream
git fetch upstream master
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 "spec" | |
describe User do | |
describe "#save" do | |
it "saves user record to data store" do | |
# ... | |
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
Error in line 1: while requiring "./spec/compiler/codegen/special_vars_spec.cr" | |
Syntax error in ./spec/compiler/codegen/special_vars_spec.cr:4: unterminated macro | |
macro verify_special_vars(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
macro create_double(name, &block) | |
module ::Mocks | |
module Doubles | |
class {{name.id}} < ::Mocks::BaseDouble | |
def ==(other) | |
self.same?(other) | |
end | |
def ==(other : Value) | |
false |
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
# Instead of doing this: | |
{} of Array(Object) => Result | |
# Now I do this: | |
class Args | |
getter value | |
def initialize(@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
randomString :: (a -> b) -> a -> a -> [b] | |
-- to create a random string "apply face to keyboard and roll" | |
randomString face keyboard roll = map face [keyboard, roll] |
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
# Smelly code | |
class Example | |
def do_stuff(something) | |
return if invalid_thing?(something) | |
@thing = something | |
end | |
private def invalid_thing?(thing) | |
# determine if thing is valid | |
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
#include <curses.h> | |
#include <stdio.h> | |
#define pp(x, d) printf("% 15s = % 10lu # - %s\n", #x, x, #d); | |
int main() { | |
pp(A_NORMAL, Normal display (no highlight)) | |
pp(A_STANDOUT, Best highlighting mode of the terminal.) | |
pp(A_UNDERLINE, Underlining) | |
pp(A_REVERSE, Reverse video) |
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
.where(query_hash) | |
finds multiple records==957== Invalid read of size 8 | |
==957== at 0x4A0FB5: GC_generic_malloc_many (in /home/oleksii/code/github/waterlink/mysql_adapter.cr/integration_spec) | |
==957== by 0x4AA30E: GC_malloc_atomic (in /home/oleksii/code/github/waterlink/mysql_adapter.cr/integration_spec) | |
==957== by 0x4A06EC: GC_generic_or_special_malloc (in /home/oleksii/code/github/waterlink/mysql_adapter.cr/integration_spec) | |
==957== by 0x4A08AA: GC_realloc (in /home/oleksii/code/github/waterlink/mysql_adapter.cr/integration_spec) | |
==957== by 0x4142E5: __crystal_realloc (in /home/oleksii/code/github/waterlink/mysql_adapter.cr/integration_spec) | |
==957== by 0x42068E: *Pointer(UInt8)@Pointer(T)#realloc<Pointer(UInt8), Int32>:Pointer(UInt8) (in /home/oleksii/code/github/waterlink/mysql_adapter.cr/integration_spec) | |
==957== by 0x4199B6: *String::Builder#resize_to_capacity<String::Builder, Int32>:Pointer(UInt8) (in /home/oleksii/code/github/waterlink/mysql_adapter.cr/integration_spec) | |
==957== |
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
ActiveRecord::Model | |
.new | |
creates person | |
doesn't have id | |
doesn't have any else field | |
doesn't care about non-defined fields | |
.fields | |
returns fields defined on model | |
#== | |
is equal object to object with the same fields |