Skip to content

Instantly share code, notes, and snippets.

🖥
Suncoast Developers Guilding

Tatyanna Cobb TatyCat

  • FL
View GitHub Profile
@TatyCat
TatyCat / new_world.rb
Created Mar 13, 2019
ruby hw - New World
View new_world.rb
# Gavin Stark Psuedo Code
# 1. We remember that a is 1
# 2. We remember that b is 100
# 3. We remember that z is 0
# 4. We tell the user we are going to
# guess a number between "a" and "b"
# 5. User chooses number
# 6. We remember our guess is (a+b) / 2
# 7. Tell the user that we are guessing the number "guess"
# 8. User chooses yes, no
View gist:26ca389b59b12b8dd98aee8d7327f091
# Select all columns for all employees
company_database> SELECT * FROM employees
+------+--------------+----------+------------+-------------------+-------------
| id | full_name | salary | position | phone_extension | part_time
|------+--------------+----------+------------+-------------------+-------------
| 1 | Jamie Smalls | 38293 | <null> | x334 | False
| 2 | Jake William | 3992 | Driver | x429 | True
| 3 | Casem Casey | 49292 | Accountant | x596 | False
+------+--------------+----------+------------+-------------------+-------------
SELECT 3
@TatyCat
TatyCat / gist:fa1128dd7866b6e2e25c4697ae878fca
Created Feb 14, 2019
Beginner Lost Without a Map - Kata
View gist:fa1128dd7866b6e2e25c4697ae878fca
const maps = (arrayOfInts) => {
return arrayOfInts.map( multiplied => multiplied * 2 )
}
View gist:c26703758b1d9f065189b23ae8c3547e
const check = (array,xValue) => {
return array.includes(xValue)
}
View gist:8566e0f4d4589470b6d4fc2919bdfbe2
function gooseFilter (birds) {
var geese = ["African", "Roman Tufted", "Toulouse", "Pilgrim", "Steinbacher"];
//birds array argument is filtered to check if the birds array includes a string that is in geese
//...if it isn't geese, return the string.
let filteredBirds = birds.filter(newBirds => {
return !geese.includes(newBirds)
})
console.log( filteredBirds)
View gist:a4f9bccf7427c0724979eb1cd42286d4
var Kata;
Kata = (function() {
function Kata() {}
Kata.getVolumeOfCuboid = function(length, width, height){return length * width * height};
return Kata;
})();
@TatyCat
TatyCat / gist:17453fe0218675aee492
Last active Sep 9, 2015
Intro to Ruby Reminders
View gist:17453fe0218675aee492
Interpolated strings must be enclosed in double quotes. The Ruby interpreter will not search for interpolated values in a string if single quotes are used:
ex. p 'hello #{3}'
Notice the decimal used in the assignment of the rate variable. Decimals in programming are called Floats.
Notice the usage of the _ in the assignment of the principal variable. Ruby allows an _ to be used in numbers for better readability. Although an _ can be placed anywhere in a number, the best practice is to place them where a comma would normally be placed. (e.g. 1_000_000).
IF EXAMPLE STATEMENT
def can_buy_apple_with?(money)
if money > 5
You can’t perform that action at this time.