Skip to content

Instantly share code, notes, and snippets.

select {
case val := <-highPri:
return val
case val := <-lowPri:
return val
}
@jeeyoungk
jeeyoungk / main.go
Last active July 7, 2019 01:37
Go - Selecting channels with priorities (solution)
func SelectWithPriorities(highPri <-chan int, lowPri <-chan int) int {
select {
case val := <-highPri:
return val
default:
select {
case val := <-highPri:
return val
case val := <-lowPri:
return val

Keybase proof

I hereby claim:

  • I am jeeyoungk on github.
  • I am jee (https://keybase.io/jee) on keybase.
  • I have a public key whose fingerprint is 4ABA 0FEA 02E4 6B57 C136 DD68 AAF9 F10E D562 9E8C

To claim this, I am signing this object:

Last login: Sun Jul 27 01:44:08 on ttys001
jeeyoungk@kundera:~$ /Users/jeeyoungk/Desktop/mathworks_downloads/R2011a_Student_Version/install ; exit;
Preparing installation files ...
Installing ...
Exception in thread "main" com.google.inject.ProvisionException: Guice provision errors:
1) Error in custom provider, java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at com.mathworks.wizard.WizardModule.provideDisplayProperties(WizardModule.java:61)
while locating com.mathworks.instutil.DisplayProperties
at com.mathworks.wizard.ui.components.ComponentsModule.providePaintStrategy(ComponentsModule.java:72)
/*bin/mkdir /tmp/crazy 2> /dev/null
javac -d /tmp/crazy $0 `dirname $0`/Main.java
java -cp /tmp/crazy Main "$@"
exit
*/
import java.util.Calendar;
public class Main {
public static void main(String... args) {
System.out.println(Calendar.getInstance().get(Calendar.YEAR));
/**
* Permute the given input array, calling callback for each of the
* permutation.
*/
function permute(input, callback) {
var contains = []; // boolean flags.
var permutation = [];
var N = input.length;
for (var i = 0; i < N; i++) {
contains.push(false);
public class Test {
public static void main(String ... args) {
System\u002eout\u002eprintln("hello, world");
}
}
mysql> CREATE TABLE temp (col1 INT, col2 INT, col3 INT);
Query OK, 0 rows affected (0.02 sec)
mysql>
mysql> INSERT INTO temp (col1, col2, col3) values (1,2,3);
Query OK, 1 row affected (0.01 sec)
mysql> INSERT INTO temp (col1, col2, col3) values (1,3,4);
Query OK, 1 row affected (0.00 sec)
hello, world
alert('foo')