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
| #I thought I would try something shuffling the array in-place destructively: | |
| def destructive_perfect_shuffle(array, cut_size) | |
| cut_size.times do |i| | |
| array.insert(-cut_size + i, array.shift) | |
| end | |
| array | |
| end | |
| #and then implementing a similar counting method: |
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
| <head> | |
| </head> | |
| <body> | |
| <div id="heading">HaslgfinwergeinroGIENROGIWENRGOWIENGOWEIRGNQOWEIRGNOWIERGNWOEIRGNOQEWRIGNOEQIRNGOQEIRGN</div> | |
| <h2 id="bye">Bye</h2> | |
| <textarea id="usertext">insert text</textarea> | |
| <script src="test.js"></script> | |
| </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
| function numbersInWords(number){ | |
| printArray = []; | |
| ones = ["zero","one", "two", "three", "four", "five","six", "seven", "eight", "nine"]; | |
| teens = ["ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen"]; | |
| tens = ["twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"]; | |
| if(number < 10) | |
| { | |
| return ones[number]; | |
| } |
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
| table, .cell{ | |
| border: 4px solid green; | |
| width: 800px; | |
| height: 300px; | |
| text-align: center; | |
| background-color: gray; | |
| } | |
| img { | |
| width:200px; |
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
| var shuffle = function(originalArray){ | |
| shuffledArray = [] | |
| while(originalArray.length > 0){ | |
| var randomIndex = Math.floor(Math.random()*originalArray.length) | |
| shuffledArray.push(originalArray[randomIndex]) | |
| originalArray.splice(randomIndex, 1) | |
| } | |
| return shuffledArray | |
| } |
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
| https://github.com/dmill/ar-student-schema |
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 'sqlite3' | |
| $db = SQLite3::Database.new 'address_book.db' | |
| module AddressBookDB | |
| def self.setup | |
| $db.execute( | |
| <<-SQL | |
| CREATE TABLE IF NOT EXISTS contacts ( |
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
| class Car | |
| @@WHEELS = 4 | |
| def initialize(args) | |
| @color = args[:color] | |
| @wheels = @@WHEELS | |
| end | |
| def drive | |
| @status = :driving | |
| end | |
| def brake |
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 'open-uri' | |
| require 'nokogiri' | |
| class Player | |
| attr_reader :name, :position, :pts | |
| def initialize(player_hash) | |
| @name = player_hash[:name] | |
| @position = player_hash[:position] | |
| @pts = player_hash[:pts].to_f | |
| @reb = player_hash[:reb].to_f |
NewerOlder