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 { createSQLiteThread, createHttpBackend } from "npm:sqlite-wasm-http"; | |
// This is required hack: | |
const OldWorker = globalThis.Worker; | |
// @ts-ignore: Default to module workers | |
globalThis.Worker = class { | |
constructor(url: URL, opts: any = {}) { | |
return new OldWorker(url, { type: "module", ...opts }); | |
} | |
}; |
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 pool = new Pool({ | |
max: 300, | |
connectionTimeoutMillis: 20000, | |
host: "127.0.0.1", | |
port: 5432, | |
user: 'citus', | |
password: () => "password", | |
database: 'citus', | |
ssl: false, |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>Document</title> | |
</head> | |
<body> | |
LOOK AT THE CONSOLE |
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
// @deno-types="npm:@types/sql.js" | |
import { default as initSqlJs } from "npm:sql.js"; | |
import { IDatabase, QueryResult } from "./Database.ts"; | |
export class Database implements IDatabase { | |
private path: string; | |
private sqliteJs?: initSqlJs.SqlJsStatic; | |
private db?: initSqlJs.Database; | |
private inited = false; |
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
<?php | |
add_action("init", function () { | |
// Ob_start twice, intentionally | |
ob_start(); | |
?> | |
<script type="module"> | |
<?php ob_start(); ?> | |
wp.blocks.registerBlockType("temp/shortcode", { |
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
use std::sync::mpsc::Sender; | |
use windows::{ | |
core::Result, | |
s, | |
Win32::{ | |
Foundation::{HANDLE, HWND, LPARAM, LRESULT, WPARAM}, | |
System::{ | |
LibraryLoader::GetModuleHandleA, | |
Power::{ |
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
struct MyThreadWrapper { | |
thread: Option<std::thread::JoinHandle<()>>, | |
} | |
impl Drop for MyThreadWrapper { | |
fn drop(&mut self) { | |
if let Some(thread) = self.thread.take() { | |
let _ = thread.join(); | |
} | |
} | |
} |
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
use windows::{ | |
core::{GUID, HSTRING}, | |
Win32::{ | |
Foundation::HWND, | |
System::{ | |
Com::{CoInitializeEx, COINIT_APARTMENTTHREADED}, | |
Threading::{ | |
CreateThread, GetCurrentThreadId, WaitForSingleObject, THREAD_CREATION_FLAGS, | |
}, | |
}, |
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
// Dependency free HSTRING implementation | |
use std::ffi::OsStr; | |
use std::ffi::{c_void, OsString}; | |
use std::os::windows::ffi::OsStrExt; | |
use std::os::windows::ffi::OsStringExt; | |
type LPCWSTR = *const u16; | |
type HRESULT = i32; |
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
// Cargo.toml | |
// | |
// [dependencies] | |
// macro_rules_attribute = "0.1" | |
#[macro_use] | |
extern crate macro_rules_attribute; | |
// How to decorate a function |
NewerOlder