Welcome! This page is using CodeRay 1.1.2.
We currently have
3049 rays
in the database.
You can add a
New Ray
or browse the posted rays by pages.
Ruby test |
13 lines
of
Ruby
|
318 Bytes |
Show |
Edit |
Expand |
1
2
3
4
5
6
7
8
9
10
11 |
task :turn_off_alarm do
puts "Turned off alarm"
end
task :make_coffee do
cups = ENV["COFFEE_CUPS"] || 2
puts "Made #{cups} cups of coffee."
end
task... |
|
Ruby test |
42 lines
of
Ruby
|
577 Bytes |
Show |
Edit |
Expand |
1
2
3
4
5
6
7
8
9
10
11
12 |
h = Hash[:key1, 'value1', :key2, 'value2']
h = {key1 : ‘value1’, key2 : ‘value2’}
a = Array.new(); a << 1; a << 2;
a = [0,2,3]
class SomeClass
end
SomeClass = Class.new do
... |
|
Ruby test |
42 lines
of
Ruby
|
491 Bytes |
Show |
Edit |
Expand |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 |
h = Hash.new
h = {}
a = Array.new
a = []
class SomeClass
end
SomeClass = Class.new do
end
class MyHash < Hash
end
MyHash = Class.new(MyHash) do
... |
|
Ruby test |
7 lines
of
Ruby
|
117 Bytes |
Show |
Edit |
Expand |
1
2
3
4
5
6
7 |
class Test
def some_method
puts "doing stuff...no bigs"
end
end
a_method = Test.method(:some_method) |
|
Ruby test |
19 lines
of
Ruby
|
280 Bytes |
Show |
Edit |
Expand |
1
2
3
4
5
6
7
8
9
10
11
12
13 |
"string instance".object_id
"string instance".class
"string instance".object_id
"string instance".class
:symbol_instance.object_id
:symbol_instance.class
5.object_id
5.class
String.... |
|
Workout log |
33 lines
of
Ruby
by
Ahmed
|
962 Bytes |
Show |
Edit |
Expand |
1
2
3
4 |
class WorkoutLog
attr_accessor :name, :current_weight,:date, :gym, :duration, :muscle_group
attr_reader :total_exersises
def initialize(name, current_weight, date, gym, duration, muscle_gr... |
|
scala try |
62 lines
of
Ruby
by
zhitko
|
3.25 KB |
Show |
Edit |
Expand |
1
2
3
4 |
case class IslandAttachContent(
id: Option[Long]
, parentId: Option[Long]
, visibility: Visibility... |
|
Test |
17 lines
of
PHP
by
me
|
732 Bytes |
Show |
Edit |
Expand |
|
githubapi |
15 lines
of
PHP
|
450 Bytes |
Show |
Edit |
Expand |
1
2
3
4
5
6 |
<?php
$data = 'client_id=' . $_GET['client_id'] .
'&client_secret=' . $_GET['client_secret'] .
'&code=' . urlencode($_GET['code']);
$curl = curl_init("https://github.com/login/oauth/a... |
|
asdf |
8 lines
of
C
|
263 Bytes |
Show |
Edit |
Expand |
1
2
3
4
5 |
- if @paste.errors.any?
#error_explanation
%h2= "#{pluralize(@paste.errors.count, "error")} prohibited thi paste from being saved:"
%ul
- @paste.errors.full_messages.each d... |
|