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
| import React, { Component } from 'react' | |
| import './App.css' | |
| import ListItem from './ListItem' | |
| function arrayGenerator(length) { | |
| return Array.apply(null, { length: length }).map(Number.call, Number) | |
| } | |
| class App extends Component { | |
| constructor(props) { |
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 color = require('colors'); | |
| var fs = require('fs'); | |
| var player1 = { | |
| cash: 50, | |
| wins: 0 | |
| }; | |
| var player2 = { | |
| cash: 50, | |
| wins: 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
| var net = require('net'); | |
| var server = net.createServer(function(socket) { | |
| var date = printTime(); | |
| socket.end(date); | |
| }); | |
| function zeroFill(i) { | |
| return (i < 10 ? '0' : '') + i; | |
| } |
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 determine_free_bottles (investment) | |
| process_purchase(investment) | |
| begin | |
| find_bottles(@caps, @empty_bottles) | |
| end while @empty_bottles > 1 || @caps > 3 | |
| print_result | |
| 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
| # Find the maximum | |
| def maximum(arr) | |
| arr.inject { |x, max| x > max ? x : max } | |
| end | |
| # expect it to return 42 below | |
| result = maximum([2, 42, 22, 02]) | |
| puts "max of 2, 42, 22, 02 is: #{result}" | |
| # expect it to return nil when empty array is passed in |
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
| scottdomes@scottdomes-ThinkPad:~/WebDev/RubyTest$ pry | |
| [1] pry(main)> def say_hi(name) | |
| [1] pry(main)* | |
| [1] pry(main)* "Hi, #{name}." | |
| [1] pry(main)* end | |
| => nil | |
| [2] pry(main)> say_hi("Scott") | |
| => "Hi, Scott." | |
| [3] pry(main)> Time.now | |
| => 2016-03-01 11:00:06 -0800 |
NewerOlder