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 A | |
| def isVisable | |
| true | |
| end | |
| def method_missing(m, *args, &block) | |
| if m =~ /eh$/i | |
| merica = "is" + m.to_s.capitalize.split(/eh$/i).first | |
| if self.respond_to?(merica) | |
| return self.send(merica) |
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
| // ಠ_ಠ.scala | |
| object ಠ_ಠ { | |
| // ಠ_ಠ really "Replace user" | |
| def really(str : String) = { | |
| System.err.println(str) | |
| } | |
| // ಠ_ಠ ¬_¬ "Can't provide --log and --no-log" | |
| def ¬_¬(str : String) = { |
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 Point { | |
| var x : Int = 0 | |
| var y : Int = 0 | |
| def apply(newX : Int, newY : Int) : Point = { | |
| x = newX | |
| y = newY | |
| this | |
| } |
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
| trait Node { | |
| var prev : Node = null | |
| var next : Node = null | |
| def ✂ : Node = { delete } | |
| def unary_~ : Node = { delete } | |
| def ⇠ : Node = { prev } | |
| def ⇢ : Node = { next } | |
| def ⇠? : Boolean = { prev == null } | |
| def ⇢? : Boolean = { prev == null } |
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
| (defun factorial (n) | |
| (if (<= n 1) | |
| 1 | |
| (* n (factorial (- n 1))))) | |
| (dotimes (x 10) | |
| (let ((n (+ x 1))) | |
| (format t "factorial ~2D = ~D~%" n (factorial n)))) | |
| ; output |
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
| public class AnExample { | |
| public static void main(String[] args) { | |
| System.out.println( | |
| ColoredString.s("Such ANSI, Easy Color. Many wow.").bold().cyan().blink(); | |
| ); | |
| } | |
| } |
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[] rgb = {0,0,0}; | |
| int i = 0; // current working index | |
| int step = 25; | |
| while(true) { | |
| // so raise R, raise G, drop R, raise B, drop G, etc? | |
| int p = (i + 2) % 3; // previous index | |
| if(rgb[i] >= 255 && rgb[p] > 0) { | |
| rgb[p] -= step; | |
| if(rgb[p] < 0) rgb[p] = 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
| $ erl | |
| 1> c(misc_lib). % compile module | |
| {ok,misc_lib} | |
| 2> misc_lib:quickSort([1, 9, 6, 3, 0, 5, 2, 5082, 5, 2]). | |
| [0,1,2,2,3,5,5,6,9,5082] |
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 crypt(mod, key, data, hashes = 50): | |
| encrypted = [] | |
| for v in data: | |
| for i in range(0, hashes + 1): | |
| v = (v ** key) % mod | |
| encrypted.append(v) | |
| return list(map(int, encrypted)) | |
| # My keys (p and q are intermediates) | |
| p = 11 |
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
| import pgp | |
| print("Generating keys...") | |
| p = pgp.generateLargePrime(1024) | |
| q = pgp.generateLargePrime(1024) | |
| mod = p * q | |
| print("Generating public key...") | |
| public = pgp.generatePublic(p, q) | |
| print("Generating private key...") | |
| private = pgp.generatePrivate(p, q, public) |