Skip to content

Instantly share code, notes, and snippets.


yaiyaichu mgiagante

  • Argentina
View GitHub Profile
mgiagante / .Xresources
Created Apr 15, 2019
There are comments with links to the Arch wiki on how to configure the plugins. Other than that, I use a Nerd Font but you can opt not to.
View .Xresources
Xft.dpi: 96
Xft.antialias: true
Xft.hinting: true
Xft.rgba: rgb
Xft.autohint: false
Xft.hintstyle: hintslight
Xft.lcdfilter: lcddefault
xvt.color12: rgb:5c/5c/ff
XTerm*background: #222D31
View medium-oop-series-examples-3.rb
class MyClass
@@my_class_variable = "Class variable content."
def initialize
@my_instance_variable = "Instance variable content."
# Class methods have a "self." before their name. For now we won't go into the details
# on why it is that way.
def self.thing_my_class_does
View medium-oop-series-examples-0.rb
def greet(who)
"Hi, #{who}!"
mgiagante / medium-oop-series-examples-1.rb
Last active Apr 2, 2018
Class definition an instantiation example.
View medium-oop-series-examples-1.rb
class Dog
def initialize(name)
@name = name
def bark
puts "woof!"
mgiagante / medium-oop-series-examples-2.rb
Last active May 4, 2018
Encapsulation example for my object-oriented programming series in
View medium-oop-series-examples-2.rb
class Dragon
def initialize
# ...
def fly
100.times do
View app.rb
require "cuba"
require "mote"
require "mote/render"
Cuba.plugin Mote::Render
require_relative "controllers/pages"
require_relative "controllers/tasks"
require_relative "db/data_store"
View database_cleaner.rb
RSpec.configure do |config|
config.use_transactional_fixtures = false
config.before(:suite) do
DatabaseCleaner.strategy = :transaction
config.around(:each) do |example| do
View semaphores_7.txt
process Employee {
while true {
process Customer[c = 0 to N - 1] {
while timeout[c] < 10 {
View semaphores_6
sem arrived[0..E - 1] = ([E] 0)
sem start_working[0..E - 1] = ([E] 0)
sem finish_task_mutex = 1
int remaining_tasks = T
int tasks_done[0..E - 1] = ([E] 0)
task tasks[0..T - 1] = ([T] generate_task())
reward rewards[0..E - 1] = ([E] null)
View semaphores_5.txt
sem task_chosen[0..49] = ([50] 0)
sem able_to_work[0..49] = ([50] 0)
sem notify_completion[0..9] = ([10] 1) // Mutex array for notifying each shared task was finished by a single student.
sem grade_mutex = 1
sem some_task_was_finished = 0
task tasks[0..9] = ([10] generate_task())
int students_that_finished[0..9] = ([10] 0) // Amount of students that finished working on each task.
int grade[0..9] // Puntaje. Es el orden en el que cada equipo 0..9 terminó de trabajar en su tarea.
int finished_task // Sólo la declaro. No la inicializo porque su valor inicial no importa.
You can’t perform that action at this time.