Skip to content

Instantly share code, notes, and snippets.

View rodloboz's full-sized avatar

Rui Freitas rodloboz

View GitHub Profile
@rodloboz
rodloboz / 01-recap.rb
Created January 16, 2020 23:54
Ruby 04 - Hash and Symbols
# Built-int Objects
34 # Integer
"Hello world!" # String
3.14 # Float
true # Boolean
(1..10) # Range
[1, 2, "hello", ["a"]] # Array
nil # Nil
# box/container where stuff/information/data
@rodloboz
rodloboz / 01-arrays.rb
Created January 15, 2020 23:57
Ruby 03 - Iterators and Blocks
# Ranges
range1 = (1..5)
p range1.to_a
range2 = (1...5)
p range2.to_a
# Arrays
@rodloboz
rodloboz / presenter_vs_decorator.rb
Created January 15, 2020 03:43
Presenters & Decorators
class UserProfilePresenter
def initialize(user)
@user = user
end
def full_name
"#{@user.first_name} #{@user.last_name}"
end
def short_summary
@rodloboz
rodloboz / 01-recap.rb
Last active January 14, 2020 23:32
Ruby 02 - Flow and Array
# Data Types / Built-in Objects
"Word" # String
'Word' # String
34 # Integer
3.14 # Float
true # Boolean - TrueClass
false # Boolean - FalseClass
@rodloboz
rodloboz / git_teams.sh
Created May 27, 2019 00:40
Using Git to Collaborate as a Team
# before starting a new feature, ensure you have an updated master
(master) git pull origin master
# create a feature branch
(master) git checkout -b my_new_feature
# commit in your feature as you complete milestones
(my_new_feature) git add .
(my_new_feature) git commit -m "adds some changes to my project"
@rodloboz
rodloboz / another_solution.js
Created May 14, 2019 08:14
LIVECODE: Tile Puzzle
// todo
const hintButton = document.querySelector('#show-hint');
const hint = document.querySelector('.hint');
hintButton.addEventListener('click', () => {
hint.classList.toggle('active');
});
const isEmptyAbove = ({ tileColumn, tileRow, emptyTileColumn, emptyTileRow }) => {
return (tileColumn == emptyTileColumn && tileRow == emptyTileRow - 1);
console.log("Hello, world!")
"Hello" // String
'Hello' // String
4 // Number
3.14 // Number
true // Boolean
@rodloboz
rodloboz / db_queries.sql
Created May 1, 2019 23:39
Schema Design and DBs - Batch 258
-- Give me the specialty of all doctors
SELECT specialty FROM doctors
-- Give me all cardiologists
SELECT * FROM doctors WHERE specialty = 'cardiology'
-- How many Surgeons are there?
SELECT COUNT(*) FROM doctors
WHERE specialty = "%Surgery"
// app/javascript/stylesheets/components/_dropdown.scss
.dropdown-item {
@apply px-4 py-2 block text-black ;
}
.dropdown-item:hover {
@apply bg-gray-100;
}
document.getElementById('followers-count').innerHTML = '<%= @user.followers_count %>';
document.getElementById('followings-count').innerHTML = '<%= @user.followings_count %>';