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> | |
| <style> | |
| body { background: #358; color: #fff; padding: 50px; font-family: sans-serif; } | |
| </style> | |
| <!-- we need to load jquery before we use it --> | |
| <script type="text/javascript" src="http://code.jquery.com/jquery-1.11.1.min.js"></script> | |
| <script> | |
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 'active_record' | |
| require 'pg' | |
| ActiveRecord::Base.logger = Logger.new(STDOUT) | |
| ActiveRecord::Base.establish_connection( | |
| :adapter => "postgresql", | |
| :host => 'ec2-54-204-41-178.compute-1.amazonaws.com', | |
| :username => 'bmdjwluxchptuq', | |
| :password => 'aEH-cKdr2zoXYUAjI8Xjma5eXK', |
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 MuratsController | |
| def initialize | |
| end | |
| def index | |
| end | |
| def beard | |
| 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
| class ORM | |
| def save | |
| table_name = self.class | |
| sql_columns = self.instance_variables.map do |i| | |
| i.slice(1, i.length) | |
| end.join(', ') | |
| sql_values = self.instance_variables.map do |i| | |
| '"' << self.instance_variable_get("#{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
| // Built from Mohit Cheppudira's sine wave generator - http://0xfe.blogspot.com | |
| // Modified by Murat Ayfer - http://muratayfer.com | |
| soundWave = function(context) { | |
| // xs is a list of x (time) values, one per wave. | |
| // time is not represented as synchronized clicks or milliseconds, its passing is freq dependent | |
| // so that's why we keep a value per each wave. | |
| this.xs = []; | |
| this.counter = 0; | |
| this.context = context; |
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
| # must be baller and either furnished or rent cheaper than 2100 | |
| def rent?(furnished, rent, baller) | |
| if baller && furnished || rent < 2100 | |
| return true | |
| else | |
| return false | |
| 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
| puts "Enter A" | |
| a = gets.chomp | |
| puts "Enter B" | |
| b = gets.chomp | |
| c = Integer(a) + Integer(b) | |
| puts c |
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(numbers) | |
| largest = numbers.first | |
| index = 0 | |
| # keep looping over every element in the array | |
| while index < numbers.size | |
| # check to see if current number is larger than the largest one so far |
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> | |
| <!-- we need to load jquery before we use it --> | |
| <script type="text/javascript" src="http://code.jquery.com/jquery-1.11.1.min.js"></script> | |
| <script> | |
| // this code must run when the document is fully loaded | |
| // otherwise we will try to bind events on elements that don't exist yet (html and code is parsed top to bottom) | |
| $(document).ready( function () { |
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
| r = { | |
| "shrimp" => [ | |
| "algae", | |
| "other_shrimps", | |
| "seaweed", | |
| ], | |
| "toad" => [ | |
| "children", | |
| "flies", |