Skip to content

Instantly share code, notes, and snippets.

View Raynes's full-sized avatar

Anthony Grimes Raynes

View GitHub Profile
class Integer
def add(n)
self + n
end
def divide(n)
self / n
end
def multiply(n)
self * n
end
class Person
include Comparable
attr_reader :name
def initialize(name)
@name = name
end
def to_s
"#{@name}"
end
def <=>(other)
class Person
include Comparable
attr_reader :name
def initialize(name)
@name = name
end
def to_s
"#{@name}"
end
def <=>(other)
[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
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)
class Integer
def expo(n)
(1..n).inject {|acc| acc += self * self} - 1
end
end
(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]
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
const int LENGTH = 81;
ifstream inFile;
fstream outFile("C:\\red.txt", ios::in);
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
const int LENGTH = 81;
ifstream inFile;
fstream outFile("C:\\red.txt", ios::in);
(ns main.main)
(defn main [] (println "Hello, World!"))