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
// https://github.com/DjDeveloperr/deno_win32 | |
import { HKEY_CURRENT_USER, REG_SZ, RegDeleteKeyValueA, RegSetKeyValueA } from "https://win32.deno.dev/0.4.1/System.Registry"; | |
const HKEY = Deno.UnsafePointer.create(BigInt(HKEY_CURRENT_USER)); | |
const STARTUP_RUN = "Software\\Microsoft\\Windows\\CurrentVersion\\Run"; | |
export function registerStartupRun(name: string, command: string) { | |
const ffiString = new TextEncoder().encode(`${command}\0`); | |
const lpData = Deno.UnsafePointer.of(ffiString); | |
// https://learn.microsoft.com/en-us/windows/win32/api/winreg/nf-winreg-regsetkeyvaluea |
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
/** Provides access to root object for the Windows Script Host object model. | |
* @see https://www.vbsedit.com/html/4dc0e2db-3234-4383-afba-147154041dfd.asp */ | |
interface WScript { | |
/** Returns the full path of the currently running script. | |
* @see https://www.vbsedit.com/html/00f4fa13-345d-492f-b879-4b34160f8cc1.asp */ | |
readonly ScriptFullName: string; | |
} | |
declare var WScript: WScript; |
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
const cssUrl = "/your.css"; | |
const cssRequest = await fetch(cssUrl); | |
if (!cssRequest.ok) { | |
throw new Error(`Failed to load '${cssUrl}' (status: ${cssRequest.status})`); | |
} | |
const cssText = await cssRequest.text(); | |
const styleSheet = new CSSStyleSheet(); | |
await styleSheet.replace(cssText); | |
document.adoptedStyleSheets = [styleSheet, ...document.adoptedStyleSheets]; | |
// CSS is ready to be used now |
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 { | |
SM_CXSCREEN, | |
SM_CYSCREEN, | |
GetSystemMetrics, | |
SPI_GETWORKAREA, | |
SystemParametersInfoA, | |
} from "https://win32.deno.dev/0.4.1/UI.WindowsAndMessaging"; | |
import { | |
allocRECT, | |
RECTView, |
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
[System.Reflection.Assembly]::LoadWithPartialName('System.Drawing') | Out-Null; | |
$Icon = [System.Drawing.Icon]::ExtractAssociatedIcon( | |
[System.Environment]::ExpandEnvironmentVariables('%SystemRoot%\System32\newdev.exe') | |
); | |
$Stream = [System.IO.File]::Open( | |
'newdev.ico', | |
[System.IO.FileMode]::CreateNew | |
); | |
$Icon.Save($Stream); |
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
const originalAttachShadow = Element.prototype.attachShadow; | |
Element.prototype.attachShadow = function attachShadow(...args) { | |
const detail = originalAttachShadow.apply(this, args); | |
this.dispatchEvent(new CustomEvent("shadowRootAttached", { detail })); | |
return detail; | |
}; |
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
CLASS main DEFINITION | |
PUBLIC | |
FINAL | |
CREATE PUBLIC. | |
PUBLIC SECTION. | |
METHODS say_hello | |
IMPORTING | |
name TYPE string | |
RETURNING |
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
function DataAppender(array = new Uint8Array(8)) { | |
let length = array.length; | |
let offset = 0; | |
let view = new DataView(array.buffer); | |
const textEncoder = new TextEncoder(); | |
const grow = () => { | |
length = array.length * 2; |
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
private fun convertToJson(v: Any?): String { | |
return when (v) { | |
is String -> v.toJson() | |
is Boolean -> v.toJson() | |
is Number -> v.toJson() | |
is Array<*> -> v.toJson() | |
is Collection<*> -> v.toJson() | |
is Map<*, *> -> v.toJson() | |
else -> v?.toJson() ?: "null" | |
} |
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
// Ported from https://github.com/deoxxa/proquint | |
const encodeConsonants = "bdfghjklmnprstvz".split(""); | |
const encodeVowels = "aiou".split(""); | |
const decodeConsonants = Object.fromEntries(encodeConsonants.map((x, i) => [x, i])); | |
const decodeVowels = Object.fromEntries(encodeVowels.map((x, i) => [x, i])); | |
export function encode(array: Uint16Array) { | |
const view = new DataView(array.buffer); | |
const bits = []; |
NewerOlder