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 MetaApi from 'metaapi.cloud-sdk'; | |
import { Order } from './types/Order'; | |
import { PnL } from './types/PnL'; | |
import { Position } from './types/Position'; | |
import { error, log } from './logging'; | |
import { ConditionalOrderProps, IBroker, SubmitFuturesOrderProps } from './IBroker'; | |
import { MetatraderAccount, RpcMetaApiConnectionInstance } from 'metaapi.cloud-sdk'; | |
export class MetaAPIBroker implements IBroker { | |
private api: MetaApi; |
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 * as MediaLibrary from "expo-media-library"; | |
// download a sample mp4 file from here https://test-videos.co.uk/bigbuckbunny/mp4-h264 | |
const url = "file:///Users/[username]/Downloads/bigbuckbunny.mp4" | |
await MediaLibrary.saveToLibraryAsync(url); | |
// throws an error `This file type is not supported yet` |
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
` | |
You are assisting the user to generate a video of their trip. Follow these instructions to guide the user in providing details about the trip and the video preferences. | |
This chat can open a window with some predefined answers or actions. | |
Use ${SHOW_DIALOG} tool to show dialog windows to the user. The parameter window_name defines which window to show. | |
Use ${SAVE_TRIP_DETAILS_TOOL} tool to save the trip details once the user confirms the trip. | |
Use ${SAVE_ORIENTATION_TOOL} tool to save the orientation once the user provides it. | |
<Instructions> |
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 { DateTime } from 'luxon'; | |
import { z } from 'zod'; | |
/** | |
* Replace type V1 with type V2. | |
*/ | |
type Replace<T, V1, V2> = T extends V1 ? V2 : never; | |
/** | |
* Replace all fields of type V1 with fields of type V2. |
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
static Color biasedColor(Color color, float offset){ | |
float value = (color.r + color.g + color.b) / 3.0; | |
float newValue = value+2.0*((float)random(0,10000)/10000.0)*offset-offset; | |
float valueRatio = newValue / value; | |
int R = (int)((float)color.r * valueRatio); | |
int G = (int)((float)color.g * valueRatio); | |
int B = (int)((float)color.b * valueRatio); | |
return Color(R,G,B); | |
} | |
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
#ifndef __TIMER_GUARD__ | |
#define __TIMER_GUARD__ | |
class TimeGuard { | |
private: | |
unsigned long lastUpdated = 0; | |
unsigned long interval; | |
public: |
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.io._ | |
import Main.file | |
import scala.collection.mutable | |
import scala.util.Random | |
object Main extends App { | |
val randomFileName = "random.txt" |