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 = "asdhasd" | |
numbers = [ | |
[1, 2, 3], | |
[4, 5, 6], | |
] | |
# WRONG |
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 'pg' | |
CONN = PG::Connection.new({ | |
host: 'localhost', | |
user: 'murat', | |
password: '', | |
dbname: 'lighthouse_2015_05' | |
}) | |
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' | |
ActiveRecord::Base.logger = Logger.new(STDOUT) | |
ActiveRecord::Base.establish_connection( | |
:adapter => "postgresql", | |
:host => 'localhost', | |
:username => 'murat', | |
:password => '', | |
:database => 'lighthouse_2015_05', |
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 CreateTeachers < ActiveRecord::Migration | |
def change | |
create_table :teachers do |t| | |
t.string :name | |
end | |
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
# no *, / or % allowed | |
def divide(number, divisor) | |
result = 0 | |
while number >= divisor | |
number -= divisor | |
result += 1 |
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
<!-- demonstrating event bubbling --> | |
<html> | |
<head> | |
<title>arceegee</title> | |
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script> | |
<style> | |
body { margin: 0; } | |
#bubble { background: #ffa; width: 200px; height: 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
// run this with "node hello_world.js" | |
console.log("Hello World", __dirname); |
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 find_most_anagram | |
words = File.open('/usr/share/dict/words').read | |
hash = Hash.new { [] } | |
words.each_line do |word| | |
word = word.strip.downcase | |
signature = word.split('').sort.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 'sinatra' | |
get '/' do | |
# whatever happens here happens on every request | |
puts "goodbye world" | |
response = "hello #{params[:username]} \n\n \ |
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
<!doctype html> | |
<html> | |
<head> | |
<title>weather</title> | |
<style> | |
body, html { | |
background: #05a; | |
color: #fff; | |
font-family: monospace; |