val n = 100
Random.nextInt(n)
ThreadLocalRandom.current().nextInt(n)
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
# frozen_string_literal: true | |
require "bundler/inline" | |
gemfile(true) do | |
source "https://rubygems.org" | |
git_source(:github) { |repo| "https://github.com/#{repo}.git" } | |
gem "rails", "6.0.0" |
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
apiVersion: v1 | |
kind: ConfigMap | |
metadata: | |
name: nginx-conf | |
data: | |
nginx.conf: | | |
user nginx; | |
worker_processes 3; | |
error_log /var/log/nginx/error.log; | |
events { |
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
using System; | |
public class SeedRandom | |
{ | |
private UnityEngine.Random.State _randomState; | |
public static int DefaultSeed() | |
{ | |
return (int)System.DateTime.Now.Ticks; | |
} |
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
public abstract class MainThreadCallback implements Callback { | |
private static final String TAG = MainThreadCallback.class.getSimpleName(); | |
abstract public void onFail(final Exception error); | |
abstract public void onSuccess(final String responseBody); | |
@Override | |
public void onFailure(final Request request, final IOException e) { |
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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading; | |
using System.Threading.Tasks; | |
using Cysharp.Threading.Tasks; | |
using UnityEngine; | |
using UnityEngine.Networking; |
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
using System; | |
namespace MyNamespace | |
{ | |
/// holds an either succeeded or failed result | |
// need latest C# version to use <out T, out E> instead | |
public interface Result<T, E> where E : Exception | |
{ | |
public bool OK { get; } |
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
# frozen_string_literal: true | |
require "bundler/inline" | |
gemfile(true) do | |
source "https://rubygems.org" | |
gem 'rspec', '~> 3.0' | |
end |
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
const URL = 'https://example.com'; | |
const CELL = 'A1' | |
const MAIL_TO = 'mail@example.com'; | |
// Create a trigger to run `main` periodically | |
function main() { | |
const sheet = SpreadsheetApp.getActiveSheet(); | |
const lastDate = readLastDate(sheet); | |
const today = Utilities.formatDate(new Date(), 'UTC', 'yyyy-MM-dd'); | |
if (lastDate === null || lastDate == today) { |
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
package net.petitviolet.ex.persistence.task | |
import akka.NotUsed | |
import akka.actor._ | |
import akka.pattern.ask | |
import akka.stream.actor.ActorSubscriberMessage.{ OnComplete, OnNext } | |
import akka.stream.actor.{ ActorPublisher, ActorSubscriber, OneByOneRequestStrategy, RequestStrategy } | |
import akka.stream.{ ActorMaterializer, ClosedShape } | |
import akka.util.Timeout | |
import org.reactivestreams.Publisher |
NewerOlder