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
| from pydantic import BaseModel | |
| class ParameterProperty(BaseModel): | |
| type: str # must be either 'string' or 'number' | |
| description: str | |
| class FunctionParameters(BaseModel): | |
| type: str # must be 'object' |
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
| @dataclass | |
| class ActorRefRemoteEnv(IRemoteEnv): | |
| remote_env: ActorHandle | |
| remote_env_refs: ActorHandle = field(default=None) | |
| remote_env_id: ObjectRef = field(default=None) | |
| def __post_init__(self): | |
| if self.remote_env_id is None: | |
| self.remote_env_id = self.remote_env.get_env_id.remote() |
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
| #include "stdio.h" | |
| #include "time.h" | |
| #include <functional> | |
| class V3{ | |
| public: | |
| V3(){} | |
| V3(float a,float b,float c):x(a),y(b),z(c){} | |
| float x; | |
| float y; | |
| float z; |
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
| #define news(T,...) std::shared_ptr<T>(new T(__VA_ARGS__)) | |
| auto splitBox(const Objects& objs,const BBox& box){ | |
| //通った! | |
| return news(TwoBox,news(BBox,box.min,vmax),news(BBox,vmin,box.max)); | |
| } |
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
| //1.流石にshared_ptrは省略するとして | |
| template <typename T> using sptr = std::shared_ptr<T>; | |
| //typedefなし | |
| sptr<std::pair<sptr<BBox>, sptr<BBox>>> splitBox(const Objects& objs,const BBox& box){ | |
| //いろいろする | |
| return sptr<std::pair<sptr<BBox>,sptr<BBox>>>(new std::pair<sptr<BBox>,sptr<BBox>>(sptr<BBox>(new BBox(box.min,vmax)),sptr<BBox>(new BBox(vmin,box.max)))); | |
| } | |
| //2.typedefあり | |
| using A = std::pair<sptr<BBox>,sptr<BBox>>; |
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 java.text.SimpleDateFormat | |
| import java.util.Date | |
| import java.util.concurrent.TimeUnit | |
| import scala.util.{Success, Try} | |
| val lines = Iterator.continually(readLine()).takeWhile(_!=null) | |
| val dateFormat = new SimpleDateFormat("""MM/dd/yy""") | |
| val timeFormat = new SimpleDateFormat("""HH:mm:ss""") | |
| def lineToCol(str:String):Try[String] = Try{ | |
| str.split('|') match { |
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
| object MakeNSolver { | |
| import scala.util.{Success, Try} | |
| trait Expr | |
| case class Number(value: Int) extends Expr | |
| case class BinOp(op: String, l: Expr, r: Expr) extends Expr | |
| val binOps: Map[String, (Int, Int) => Int] = Map( | |
| "*" -> (_ * _), | |
| "/" -> (_ / _), | |
| "+" -> (_ + _), | |
| "-" -> (_ - _)) |
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
| using UnityEngine; | |
| using System.Collections.Generic; | |
| using System; | |
| public delegate void GameEventDelegate<T>(T e); | |
| public class EventManager : MonoBehaviour { | |
| //I want to omit the type parameters on the right-hand side... like " = new Dictionary()"; | |
| private GameEventDelegate<System.Object> dummy = new GameEventDelegate<System.Object>(); | |
| private Dictionary<System.Type,GameEventDelegate<Object>> listeners = new Dictionary<GameEventDelegate<Object>>(); | |
| public void addListener<T>(GameEventDelegate<T> f){ |
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
| using System.Collections; | |
| using UnityEditor; | |
| using UnityEngine; | |
| using System.IO; | |
| [InitializeOnLoad] | |
| public class AutoSave | |
| { | |
| public static readonly string manualSaveKey = "autosave@manualSave"; |
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 scala.language.experimental.macros | |
| import scala.reflect.macros.Context | |
| trait ClassMacro{ | |
| /** | |
| * implicitly returns a class of specified type! | |
| **/ | |
| implicit def getClassMacro[T]:Class[T] = macro ClassMacroImpl.getClassMacroImpl[T] | |
| } | |
| object ClassMacroImpl{ |
NewerOlder