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
CREATE TABLE `User` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`name` varchar(255) NOT NULL, | |
`inviterId` int(11) NULL, | |
PRIMARY KEY (`id`) | |
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1; | |
CREATE TABLE `Post` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`title` varchar(255) NOT NULL, |
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
@sources.Scene | |
export class FormDemo extends RootSectionModel { | |
@constraint.min(1) | |
public seatCount: number; | |
@constraint.required | |
public phoneNumber: string; | |
public message: string = ''; |
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
export class ListDemo extends RootSectionModel { | |
public from: number = 1; | |
public to: number = 9; | |
public get filteredReservations() { | |
return this.scene.query(Reservation_SeatInRange, { from: this.from, to: this.to }); | |
} | |
public get totalCount() { | |
return this.filteredReservations.length; | |
} | |
} |
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
import org.graalvm.polyglot.*; | |
import java.lang.reflect.Array; | |
import java.lang.reflect.Field; | |
import java.util.Arrays; | |
public class Main { | |
public static void main(String[] args) throws Exception { | |
try (Context context = Context.create("js")) { | |
context.eval("js", "" + |
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
function some_important_business_process(a, b) | |
result = a + b | |
c = 3 | |
result = result * c | |
return result | |
end | |
result = some_important_business_process(1, 2) | |
print(result) |
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
function some_important_business_process(a, b) | |
result = a + b | |
c = 3 | |
result = result * c | |
return result | |
end | |
result = some_important_business_process(1, 2) | |
print(result) |
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
func ExampleUnboundedExecutor_Go_panic() { | |
concurrent.HandlePanic = func(recovered interface{}, funcName string) { | |
fmt.Println(funcName) | |
} | |
executor := concurrent.NewUnboundedExecutor() | |
executor.Go(willPanic) | |
time.Sleep(time.Second) | |
// output: | |
// github.com/modern-go/concurrent_test.willPanic | |
} |
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
// set a logger to show who is blocking | |
concurrent.InfoLogger = log.New(os.Stdout, "", 0) | |
executor := concurrent.NewUnboundedExecutor() | |
executor.Go(func(ctx context.Context) { | |
everyMillisecond := time.NewTicker(time.Millisecond) | |
for { | |
select { | |
case <-ctx.Done(): | |
// info log will be printed while we wait | |
time.Sleep(time.Second) |
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
import "github.com/modern-go/concurrent" | |
executor := concurrent.NewUnboundedExecutor() | |
executor.Go(func(ctx context.Context) { | |
everyMillisecond := time.NewTicker(time.Millisecond) | |
for { | |
select { | |
case <-ctx.Done(): | |
fmt.Println("goroutine exited") | |
return |
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 <numeric> | |
#include <algorithm> | |
#include <random> | |
#include <vector> | |
#include <iostream> | |
#include <limits> | |
typedef int V; | |
typedef std::vector<V> vi; |