Skip to content

Instantly share code, notes, and snippets.

View cuongld2's full-sized avatar

Le Dinh Cuong cuongld2

View GitHub Profile
@cuongld2
cuongld2 / extension.js
Created June 9, 2023 03:56
Sample extension.js file for configuring fauxpilot
/*! For license information please see extension.js.LICENSE.txt */
(()=>{var e={8348:e=>{const t="object"==typeof performance&&performance&&"function"==typeof performance.now?performance:Date,n="function"==typeof AbortController?AbortController:class{constructor(){this.signal=new i}abort(){this.signal.dispatchEvent("abort")}},r="function"==typeof AbortSignal,o="function"==typeof n.AbortSignal,i=r?AbortSignal:o?n.AbortController:class{constructor(){this.aborted=!1,this._listeners=[]}dispatchEvent(e){if("abort"===e){this.aborted=!0;const t={type:e,target:this};this.onabort(t),this._listeners.forEach((e=>e(t)),this)}}onabort(){}addEventListener(e,t){"abort"===e&&this._listeners.push(t)}removeEventListener(e,t){"abort"===e&&(this._listeners=this._listeners.filter((e=>e!==t)))}},s=new Set,a=(e,t)=>{const n=`LRU_CACHE_OPTION_${e}`;u(n)&&d(n,`${e} option`,`options.${t}`,g)},c=(e,t)=>{const n=`LRU_CACHE_METHOD_${e}`;if(u(n)){const{prototype:r}=g,{get:o}=Object.getOwnPropertyDescriptor(r,e);d(n,`${e} method`,`cache.${
@cuongld2
cuongld2 / drag_point_a_point_b.spec.ts
Created February 6, 2023 08:42
Drag from point a to point b using cypress
cy.get('canvas[class="cornerstone-canvas"]')
.trigger('mousedown', {
which:1,
force:true
}).wait(100)
.trigger('mousemove', {
x: 50,
y: 114,
which:1,
force:true
test(`check websocket available`, async({}) => {
const ws = new WebSocket(`${endpoint.WEBSOCKET_HOST}/example/check`,{
headers: {
Cookie: `token=${accessToken}1`
}
});
ws.on('open', function open(){
ws.send("say something")
})
@cuongld2
cuongld2 / playwright.spec.ts
Last active January 30, 2023 08:47
Example code playwright : wait for the request to finish
test(`check websocket available`, async({}) => {
await new Promise<void>(done => {
const ws = new WebSocket(`${endpoint.WEBSOCKET_HOST}/example/check`,{
headers: {
Cookie: `token=${accessToken}`
}
});
ws.on('open', function open(){
use std::panic;
use rstest::*;
fn setup(){
println!("setup 111");
}
fn teardown(){
println!("teardown 2222");
use rstest::*;
use std::sync::Once;
static INIT: Once = Once::new();
#[fixture]
pub fn setup() -> () {
INIT.call_once(|| {
println!("Hello, world!");
// initialization code here
@cuongld2
cuongld2 / main.rs
Created July 22, 2021 16:03
Comparison between .len() and .chars().count()
fn main() {
let s1=String::from("ラウトは難しいです!");
let len = calculate_length(&s1);
let chars = calculate_characters(&s1);
println!("The length of {:?} is {:?}.",s1,len);
println!("The number of chars of {:?} is {:?}.",s1,chars);
let input = Command::new("yes")
.stdout(Stdio::piped())
.spawn();
let _ = Command::new("gen3-client")
.arg("download-single")
.args(&["--profile=tysud456", "--guid=c254e7d9-bd10-4f8b-803f-5388de3eba9c","--filename-format=original","--rename"])
.stdin(input.ok().unwrap().stdout.unwrap())
.output().ok()
var geneCSV []string
geneCSV = append(geneCSV, geneBackup, strconv.Itoa(geneXML.IdList[0]))
data = append(data, geneCSV)
type SymbolSearchXml struct {
XMLName xml.Name `xml:"eSearchResult"`
Count int `xml:"Count"`
RetMax int `xml:"RetMax"`
RetStart int `xml:"RetStart"`
IdList []int `xml:"IdList>Id"`
TranslationSet string `xml:"TranslationSet"`
TranslationStack TranslationStackXml `xml:"TranslationStack"`
QueryTranslation string `xml:"QueryTranslation"`
}