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
| def block_new | |
| puts Proc.new.call | |
| end | |
| block_new{"hello"} | |
| #slow practice | |
| def herp_pass_block(&block) | |
| derp_call_block &block | |
| 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
| #0> non-block call | |
| Thread.new do | |
| blahbla... | |
| end | |
| #1> 4 simple ways to call shell or cmd | |
| `ps aux` |
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
| #Person | |
| class Person | |
| end | |
| #class method | |
| class Person | |
| def self.address | |
| puts "hangzhou" | |
| 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
| find . -type f -not -regex '\./\.git.*' | xargs cat | wc -l |
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
| int lookup(char *name, Nameval tab[], int ntab) | |
| { | |
| int low, high, mid, cmp; | |
| low = 0; | |
| high = ntab - 1; | |
| while (low <= high) { | |
| mid = (low + high) >> 2; | |
| cmp = strcmp(name, tab[mid].name); | |
| if (cmp < 0) |
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
| #Newbie programmer | |
| def factorial(x): | |
| if x == 0: | |
| return 1 | |
| else: | |
| return x * factorial(x - 1) | |
| print factorial(6) | |
| #First year programmer, studied Pascal |
NewerOlder