Skip to content

Instantly share code, notes, and snippets.

View OtavioHenrique's full-sized avatar

Otavio OtavioHenrique

View GitHub Profile
@OtavioHenrique
OtavioHenrique / ubuntu_agnoster_install.md
Created January 11, 2017 17:10 — forked from renshuki/ubuntu_agnoster_install.md
Ubuntu 14.04 + Terminator + Oh My ZSH with Agnoster Theme

Install Terminator (shell)

sudo add-apt-repository ppa:gnome-terminator
sudo apt-get update
sudo apt-get install terminator

Terminator should be setup as default now. Restart your terminal (shortcut: "Ctrl+Alt+T").

Install ZSH

@OtavioHenrique
OtavioHenrique / riot_esports_api.md
Created October 6, 2017 12:09 — forked from levi/riot_esports_api.md
Riot LoL eSports Unofficial API Documentation
@OtavioHenrique
OtavioHenrique / riot_esports_api.md
Created October 6, 2017 12:09 — forked from levi/riot_esports_api.md
Riot LoL eSports Unofficial API Documentation
@OtavioHenrique
OtavioHenrique / gist:c7ca317168ce8ed0fe2623edc3c6ba86
Last active October 21, 2017 20:58
Creating simple REST API
We couldn’t find that file to show.

Law of Demete

Why?

During my studies of object oriented programming and good practices, one law/practice have gained my attention, and this was the Law of Demeter (LoD). But why this law have gained my attetion so easy? Simple, when I readed the principles os LoD I remembered a lot of codes that I have coded that breaks this law.

What is?

(Short Answer) — Basically LoD say that your object can only talk with their neighbors. On some OOP languages, simplify thinking "Use only one dot".

Basic Operations

The basic operations of one programming language is the basic math and logical operators.

Math

  • Sum
  • Minus / Division
@OtavioHenrique
OtavioHenrique / mallocMatrix.c
Last active July 18, 2018 04:46
Matrix of malloc
#include <stdio.h>
#include <stdlib.h>
void populateMatrix(int* matrix[], int width, int height) {
for(size_t i = 0; i < width; i++) {
for(size_t j = 0; j < height; j++) {
matrix[i][j] = i+j;
}
}
}
class Book
attr_reader :name, :author, :year
def initialize(name, author, year)
@name = name
@author = author
@year = year
end
def full_description
@OtavioHenrique
OtavioHenrique / so.md
Last active August 27, 2018 01:16
so.md
Command Operator Usage
00000000 stop
00000001 load memória -> acumulador
00000010 store acumulador -> memória
00000100 add acumulador -> acumulador + memória
00000101 negativo inverte sinal do acumulador
00001000 jump desvia em condicional
00001001 jle desvia se acum = 0
00001010 jgt desvia se acum > 0

Ex. A=B * C

------- Command Memory Command Operation
00001 00001011 00010010 READ B
00010 00001101 xxxxxxxx WAIT B
00011 00001011 11000000 READ C
00100 00001101 xxxxxxxx WAIT C
----- -------- -------- ------
00101 00000001 00010000 LOAD A