Skip to content

Instantly share code, notes, and snippets.

View dariodaich's full-sized avatar
🎮
There are levels to it.

Dario Daić dariodaich

🎮
There are levels to it.
  • ButterflyMX
  • Croatia, Zagreb
View GitHub Profile
@dariodaich
dariodaich / greed_koan.rb
Last active February 22, 2016 00:31
Solution to Ruby "greed koan".
# Greed is a dice game where you roll up to five dice to accumulate
# points. The following "score" function will be used to calculate the
# score of a single roll of the dice.
#
# A greed roll is scored as follows:
#
# * A set of three ones is 1000 points
#
# * A set of three numbers (other than ones) is worth 100 times the
# number. (e.g. three fives is 500 points).
@dariodaich
dariodaich / pry_28_04_2016.md
Created April 27, 2016 15:17
Pry quasi-blitz talk

Git Branching - Remote Branches

Commands

  • git ls-remote: displays references available in a remote repository along with the associated commit IDs.
  • git remote show {remote name}: Manage the set of repositories ("remotes") whose branches you track.
  • git branch | git branch -v | git branch -vv
  • git fetch {remote name}
  • git pull: Fetch from and integrate with another repository or a local branch.
  • git checkout -b {branch} {remote name}/{remote branch name}: checks out a new local branch and sets it up to track remote branch
@dariodaich
dariodaich / ruby_scopes.md
Last active August 23, 2016 22:09
Concise explanations of scopes in Ruby, and a few quizzes.

Scopes in Ruby

What is Scope?

Scope is a program space within which certain types of variables are visible.

Why is Global State evil? Main reasons:

  1. it is hard to track values and assignments of variables throughout the program
  2. since there is only one namespace available, naming variables, which is hard,

The Mythical Man-Month - go-to book summary

The following is the summary of the Mythical Man-Month aka MMM, the book that needs no introduction. It is a must-read for every participant of any software development process.

Insights sections include my personal realizations derived from the material read and are essentially a collection of a-ha moments.

@dariodaich
dariodaich / rails_variants.md
Last active November 30, 2016 08:14
Render different templates using single action.

Action Pack Variants

Basecamp had a problem. How did DHH solve it?

  • the problem : how to serve different view templates to their hybrid mobile apps and desktop clients at the same time?
  • the solution: introduce a new feature to Rails. One that will enable single action to serve different templates.

How is it done?

  • conceptually: "variant" is a symbol whose name constitutes a part

defunkt/gist cheat sheet

link: https://github.com/defunkt/gist

Main features

gist (options) my_gist.rb

Description Option Full command
single file upload / filename.format
multiple file upload / file1 file2 file3

✌️im

Native features

Autocomplete

Documented in |ins-completion|.

While in Insert mode:

  • ^x^n - for current file
@dariodaich
dariodaich / contributing_to_ruby_documentation.md
Last active February 1, 2018 17:12
Guide on contributing to Ruby documentation.

How to contribute to Ruby docs

The Steps

  1. fork the documenting-ruby/ruby repo
  2. open the GitHub issue regarding docs you want to rewrite/add
  3. make your changes to the documentation
  4. use RDOC to generate local HTML pages for a preview
  5. delete RDOC generated temp directory
  6. commit the changes

Foreword

Blamestorming - the ultimate blame game within the working environment.

Professionals set boundary between their work and private time.

Preface