| ⌘T | go to file |
| ⌘⌃P | go to project |
| ⌘R | go to methods |
| ⌃G | go to line |
| ⌘KB | toggle side bar |
| ⌘⇧P | command prompt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>Document</title> | |
| <script type="text/javascript" src="arrayoflight.js"></script> | |
| </head> | |
| <body> | |
| </body> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Practice | |
| SELECT * FROM books; | |
| SELECT last_name FROM authors; | |
| SELECT b.id, b.author_id, b.title | |
| FROM books AS b; | |
| SELECT b.id, b.title, a.id, a.last_name | |
| FROM books AS b, authors AS a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def benchmark | |
| start_time = Time.now | |
| yield | |
| end_time = Time.now | |
| final_time = end_time - start_time | |
| puts "string.reverse took #{final_time} seconds to run" | |
| end | |
| # Be careful, pasting this into IRB will take a long time to print. | |
| # It's a loooong string. :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'benchmark' | |
| # Sort the array from lowest to highest | |
| def sort(arr) | |
| n = arr.length | |
| loop do | |
| swapped = false | |
| (n-1).times do |i| | |
| if arr[i] > arr[i+1] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def talk | |
| while true | |
| print "Talk to shakil " | |
| input = gets.strip | |
| return input if input.length > 0 | |
| puts "Invalid input" | |
| end | |
| end | |
| def conversation(talk) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def maximum(arr) | |
| maxVal = arr[0] | |
| arr.each do |x| | |
| if x > maxVal | |
| maxVal = x | |
| end | |
| end | |
| maxVal | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def rent?(furnished, rent, baller) | |
| baller && (furnished || rent < 2100) | |
| end | |
| #def rent?(furnished, rent, baller) | |
| # if baller && (furnished || rent < 2100); puts "rent" ;else puts "dont rent";end | |
| #end | |
| ### |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def fizzbuzz(x,y) | |
| number = x..y | |
| number.each do |i| | |
| if i % 15 == 0 | |
| puts "FizzBuzz" | |
| elsif i % 3 == 0 | |
| puts "Fizz" | |
| elsif i %5 == 0 | |
| puts "Buzz" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 2.3.0 :001 > def say_hi(name) | |
| 2.3.0 :002?> "Hi, #{name}" | |
| 2.3.0 :003?> end | |
| => :say_hi | |
| 2.3.0 :004 > say_hi("James") | |
| => "Hi, James" | |
| 2.3.0 :005 > | |
| 2.3.0 :006 > | |
| 2.3.0 :007 > myarray = [0,0,0,0] | |
| => [0, 0, 0, 0] |