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
| ch = Channel(Nil).new | |
| spawn do | |
| 6.times do | |
| sleep 1 | |
| puts 1 | |
| end | |
| ch.send(nil) | |
| 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
| x = ->(i : Int32) { i * i } | |
| x.call(40) | |
| z = Proc(Int32, String).new { |x| x.to_s } | |
| # y = Proc(UInt64, UInt64).new{ |i| i * i } | |
| y = ->(x : UInt64) { x * x } |
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
| 50.times do |i| | |
| width = 50 | |
| rest = width - i | |
| first = rest / 2 | |
| first += 1 if (i % 2 == 1) | |
| last = rest /2 | |
| puts ("💙" * first) + ("💚" * i) + ("💜" * last) | |
| 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
| @[Link("curl")] | |
| lib LibCurl | |
| type CURL = Void* | |
| type CURLoption = Int32 | |
| fun create = curl_easy_init(): CURL | |
| fun set_opt = curl_easy_setopt(CURL, Int32, UInt8*) | |
| fun get = curl_easy_perform(CURL) | |
| fun cleanup = curl_easy_cleanup(CURL) |
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
| #!/usr/bin/env ruby | |
| @jobs = [ | |
| "sleep 1", | |
| "sleep 2", | |
| "sleep 3", | |
| "sleep 4" | |
| ] | |
| @running_jobs = Hash.new |
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
| #!/usr/bin/env ruby | |
| @jobs = [ | |
| "sleep 1", | |
| "sleep 2", | |
| "sleep 3", | |
| "sleep 4" | |
| ] | |
| @running_jobs = Hash.new |
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
| <?php | |
| /** | |
| * UUID class | |
| * | |
| * The following class generates VALID RFC 4211 COMPLIANT | |
| * Universally Unique IDentifiers (UUID) version 3, 4 and 5. | |
| * | |
| * UUIDs generated validates using OSSP UUID Tool, and output | |
| * for named-based UUIDs are exactly the same. This is a pure | |
| * PHP implementation. |
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
| #!/bin/env/ruby | |
| @script = <<THE_END | |
| Veronica Corningstone: Excuse me. | |
| Ron Burgundy: What are you doing? | |
| Veronica Corningstone: I need this machine so I can watch a tape for a story. | |
| Ron Burgundy: I'm using the tape. I'm showing Jeffrey my Emmy tape. We are watching history. | |
| Veronica Corningstone: Mr. Burgundy, I'm a professional, and I would like to be able to do my job. | |
| Ron Burgundy: Big deal. I am very professional. | |
| Veronica Corningstone: Mr. Burgundy, you are acting like a baby. |
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
| sem = java.util.concurrency.Semaphore.new 10 | |
| irb(main):024:0> sem.to_s | |
| => "java.util.concurrent.Semaphore@79f1a8a[Permits = 10]" | |
| irb(main):025:0> sem.acquire | |
| => nil | |
| irb(main):026:0> sem.to_s | |
| => "java.util.concurrent.Semaphore@79f1a8a[Permits = 9]" | |
| irb(main):027:0> sem.acquire |
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
| <?php | |
| class Test | |
| { | |
| private $m = "this is property m\n"; | |
| public function m() | |
| { | |
| return $this->m; | |
| } |