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 Integer | |
def add(n) | |
self + n | |
end | |
def divide(n) | |
self / n | |
end | |
def multiply(n) | |
self * n | |
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 Person | |
include Comparable | |
attr_reader :name | |
def initialize(name) | |
@name = name | |
end | |
def to_s | |
"#{@name}" | |
end | |
def <=>(other) |
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 | |
include Comparable | |
attr_reader :name | |
def initialize(name) | |
@name = name | |
end | |
def to_s | |
"#{@name}" | |
end | |
def <=>(other) |
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
[08:44] <pH_> guys | |
[08:45] <pH_> how to set an infinite loop in ruby? | |
[08:47] <wallerdev> loop { } | |
[08:58] <apeiros_> while 0 ... end # just for the fun of confusing C guys | |
[09:01] <dominikh> haha | |
[09:34] <Guest11530> hello | |
[09:35] <Guest11530> how is a lang like ruby diff from c++ | |
[09:35] <Guest11530> i want to know from the interpreted/compiled perspective | |
[09:36] <CoolNik123> anyone | |
[09:36] <wallerdev> sure |
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 GuessingGame | |
attr_reader :tries, :max, :num_of_tries | |
def initialize(tries, max) | |
@tries, @max, @num_of_tries = tries, max, 0 | |
@num = rand(max + 1) | |
end | |
def play(guess) |
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 Integer | |
def expo(n) | |
(1..n).inject {|acc| acc += self * self} - 1 | |
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
(ns main.test | |
(:use clojure.contrib.str-utils | |
[clojure.contrib.duck-streams :only (spit)])) | |
(def input "Source.txt") | |
(def output "red.txt") | |
(defn remove-newlines | |
"Removes all \ns from the string." | |
[s] |
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
#include <iostream> | |
#include <fstream> | |
using namespace std; | |
int main() | |
{ | |
const int LENGTH = 81; | |
ifstream inFile; | |
fstream outFile("C:\\red.txt", ios::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
#include <iostream> | |
#include <fstream> | |
using namespace std; | |
int main() | |
{ | |
const int LENGTH = 81; | |
ifstream inFile; | |
fstream outFile("C:\\red.txt", ios::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
(ns main.main) | |
(defn main [] (println "Hello, World!")) |
OlderNewer