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
| <html> | |
| <head> | |
| <title></title> | |
| </head> | |
| <body> | |
| <canvas id="myCanvas" width="1000" height="1000"></canvas> | |
| <script> | |
| var c = document.getElementById("myCanvas"); | |
| var ctx = c.getContext("2d"); |
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 getPermutationsFor = function(string){ | |
| var everythingButFirstLetter, results; | |
| results = []; | |
| if(string.length === 1){ | |
| results.push(string) | |
| }else{ | |
| string.split('').forEach(function(firstLetter, index, array){ | |
| everythingButFirstLetter = array.slice(0,index).concat(array.slice(index+1)).join(''); |
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' | |
| def snail2(array) | |
| array.empty? ? [] : array[0] + snail2(array[1..-1].transpose.reverse) | |
| end | |
| def snail_spenser(array) | |
| horiz = 0; | |
| vert = 0; | |
| result = []; |
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 waterfall(original_array, do_it_again_boolean){ | |
| var current_high = 0; | |
| var current_rough_area = 0; | |
| var fill_counter = 0; | |
| var final_adjusted_area = 0; | |
| var reverse = do_it_again_boolean; | |
| for(var i=0; i< original_array.length; i++){ | |
| if (i === 0 || original_array[i] >= current_high){ | |
| current_high = original_array[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
| class Person | |
| attr_accessor :name | |
| attr_accessor :cash | |
| def initialize(name, cash) | |
| @name = name | |
| @cash = cash | |
| puts "Hi, #{@name}. You have #{@cash}!" | |
| end | |
| end |