This file contains 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
# The key difference between public and private methods is that you | |
# can call public methods on instances of the class, but you can't | |
# call private methods on instances of the class. | |
# You can only call private methods *inside* the class. It's fine for | |
# a public method to call a private method, but you can't call a | |
# private methods directly on an instance. | |
class Wombat | |
def eat_bacon |
This file contains 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
2 | |
french | |
2 | |
chat | |
cat | |
papillon | |
butterfly | |
spanish | |
2 | |
gato |
This file contains 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
;;; An Introduction to Emacs Lisp | |
;;; Harry Schwartz, 2014 | |
;; What we'll be covering: | |
'(atoms | |
functions | |
lists | |
variables | |
defining-functions |
This file contains 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 weekday(day, month, year) | |
day_names = %w(Saturday Sunday Monday Tuesday Wednesday Thursday Friday) | |
century = (year.to_f / 100.0).floor | |
year_of_century = year % 100 | |
month += 12 if month < 3 | |
h = (day + | |
((13 * (month + 1)) / 5.0).floor + | |
year_of_century + | |
(year_of_century / 4.0).floor + |
This file contains 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 Brainfuck | |
attr_reader :data, :data_pointer, :instruction_pointer, :code | |
def initialize(code) | |
@data = Hash.new(0) | |
@data_pointer = 0 | |
@instruction_pointer = 0 | |
@code = code | |
end |
This file contains 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
int even_sum = 0; | |
int input = 0; | |
bool is_even = false; | |
cin >> input; | |
while (input > 0) { | |
is_even = ! (input % 2); | |
if (is_even) { |
This file contains 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
#!/usr/bin/env ruby | |
# Because sometimes you need a script that generates a random | |
# Github-compatible emoji. | |
emoji = %w{+1 -1 100 1234 8ball a ab abc abcd accept aerial_tramway | |
airplane alarm_clock alien ambulance anchor angel anger angry | |
anguished ant apple aquarius aries arrow_backward arrow_double_down | |
arrow_double_up arrow_down arrow_down_small arrow_forward | |
arrow_heading_down arrow_heading_up arrow_left arrow_lower_left |
This file contains 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 <stdio.h> | |
main(t,_,a) | |
char *a; | |
{ | |
return!0<t?t<3?main(-79,-13,a+main(-87,1-_,main(-86,0,a+1)+a)): | |
1,t<_?main(t+1,_,a):3,main(-94,-27+t,a)&&t==2?_<13? | |
main(2,_+1,"%s %d %d\n"):9:16:t<0?t<-72?main(_,t, | |
"@n'+,#'/*{}w+/w#cdnr/+,{}r/*de}+,/*{*+,/w{%+,/w#q#n+,/#{l+,/n{n+,/+#n+,/#\ | |
;#q#n+,/+k#;*+,/'r :'d*'3,}{w+K w'K:'+}e#';dq#'l \ | |
q#'+d'K#!/+k#;q#'r}eKK#}w'r}eKK{nl]'/#;#q#n'){)#}w'){){nl]'/+#n';d}rw' i;#\ |
NewerOlder