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
| name = "Hans" | |
| greeting = "Good evening" | |
| sum = 5 + 200 + -10 | |
| time = Time.now | |
| animals = ['cat', 'dog', 'cow', 'elephant'] | |
| puts greeting + ' ' + name | |
| puts "5 + 200 - 10 = #{sum}" | |
| puts "The first animal in the list is #{animals[0]}" |
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
| puts "5 > 7 = #{ 5 > 7 }" | |
| puts "Is 'hello' the same as 'HELLO'? #{'hello' == 'HELLO'}" |
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
| puts "You enter a room with two doors. Do you open Door 1 or 2?" | |
| print "> " | |
| door = gets.chomp | |
| if door == "1" | |
| puts "You won $5000!" | |
| elsif door == "2" | |
| puts "You stare into the endless abyss :(" | |
| else |
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 hello | |
| puts = "Hello Leia" | |
| end | |
| hello |
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 hello(name) | |
| result = "Hello " + name | |
| return result | |
| end | |
| puts hello("Leia") |
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
| #!/usr/bin/python | |
| L = [9,1,1,2,2,2,2,2,3,4,4,5,6,6,6,4,4,4,4,4,7,9,4,9] | |
| length_of_array = len(L) | |
| print("Length of array: %d" % length_of_array) | |
| # temp_con {} | |
| con = {} | |
| array_of_con = [] | |
| i = 0 |
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
| length_of_array = len(L) | |
| con = {} | |
| array_of_con = [] | |
| i = 0 | |
| k = 0 | |
| while (i < (length_of_array - 1)): | |
| first_item = L[i] | |
| second_item = L[i+1] | |
| con[k] = con.get(k, 1) | |
| if first_item == second_item: |
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
| 0x65b9ff557d727de2fbaa8bda5625b6fe2d937479 |
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
| 0x52Db1fa050ba9534478B000772106328E06C814E |
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
| <script> | |
| var stripe = Stripe('<%= Rails.application.secrets.stripe_pk %>'); | |
| var elements = stripe.elements(); | |
| var style = { | |
| base: { | |
| color: '#303238', | |
| fontSize: '16px', | |
| lineHeight: '48px', | |
| fontSmoothing: 'antialiased', |