Skip to content

Instantly share code, notes, and snippets.

View mertyildiran's full-sized avatar
:octocat:
Doing some octopus work

M. Mert Yildiran mertyildiran

:octocat:
Doing some octopus work
View GitHub Profile
@mertyildiran
mertyildiran / ismail_each.rb
Last active August 29, 2015 14:08
Ismail Each
def dizi_kopyala(dizi)
hedef = []
dizi.each do |i|
if i < 4
hedef << i
end
end
puts hedef
end
@mertyildiran
mertyildiran / LCD_helloworld.ino
Last active August 29, 2015 14:01
Arduino UNO
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int sayac = 0;
void setup() {
lcd.begin(16, 2);
lcd.print("Merhaba dunya!");
}
@mertyildiran
mertyildiran / lab1part1.v
Last active August 29, 2015 13:57
Digital Circuits and Logic Design Lab.
// Simple module that connects the SW switches to the LEDR lights
module part1 (SW, LEDR);
input [17:0] SW;
// toggle switches
output [17:0] LEDR; // red LEDs
assign LEDR = SW;
endmodule
@mertyildiran
mertyildiran / class.rb
Last active August 29, 2015 13:57
Object Oriented Programming in Ruby
#!/usr/bin/ruby
# encoding: utf-8
class Point
# XXX Her nitelik için okuyucu yazmamız gerekmiyor
attr_reader :x, :y
def initialize(x, y)
@x, @y = x, y
end
@mertyildiran
mertyildiran / BinaryTree.py
Last active August 29, 2015 13:57
Data Structures and Algorithms in Python
def BinaryTree(r):
return [r, [], []]
def insertLeft(root,newBranch):
t = root.pop(1)
if len(t) > 1:
root.insert(1, [newBranch,t,[]])
else:
root.insert(1, [newBranch, [], []])
return root
@mertyildiran
mertyildiran / hash.py
Last active August 29, 2015 13:57
Excellent Hash Algorithm :)
import csv
import time
started = time.clock()
hash_list = []
unique_hash_list = []
print "\n>> TABLE: << \n"
with open('liste.csv', 'rb') as csvfile:
@mertyildiran
mertyildiran / answer1.rb
Created March 17, 2014 13:05
Nesne Yonelimli Programlama Odev 1
#encoding: UTF-8
class Merhaba
def self.class_method
puts "Merhaba, ben bir sınıf metoduyum!"
end
def instance_method
puts "Merhaba, ben bir nesne metoduyum!"
end
end
@mertyildiran
mertyildiran / polidrom.rb
Created December 22, 2013 21:52
Polidrom RUBY
a="merve"
b="evrem"
i=0
y=b.length - 1
saydir=0
if a.length == b.length
while i < a.length
if a[i]==b[y]
saydir += 1
@mertyildiran
mertyildiran / arrayeachtotal.rb
Created December 22, 2013 21:40
Dizi elemanları toplama
girdi=[1,[2,3],4,[5],[6,7]]
b=[]
i=0
while i < girdi.length
if girdi[i].kind_of?(Array)
if !girdi[i][0].nil?
b << girdi[i][0]
end
if !girdi[i][1].nil?
b << girdi[i][1]
@mertyildiran
mertyildiran / sayitoplam.rb
Created December 22, 2013 13:19
String içerisindeki sayıları toplama
girdi = "on3d1oku5zm7ayis3"
sayilar = "0123456789"
toplam = 0
i=0
while i < girdi.length
j=0
while j < sayilar.length
if girdi[i] == sayilar[j]
toplam += girdi[i].to_i