Just a couple quick and dirty examples... see them live below the code:
| module.exports = colorSchemeChange | |
| function colorSchemeChange (onChange) { | |
| const media = window.matchMedia('(prefers-color-scheme: dark)') | |
| handleChange() | |
| if ('addEventListener' in media) { | |
| media.addEventListener('change', handleChange) | |
| } else if ('addListener' in media) { |
| #!/bin/bash | |
| [ ! -d '~/.nb-env' ] && mkdir -p '~/.nb-env' | |
| wget https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh -P ~/.nb-env | |
| cat <<'EOF' >> '~/.bashrc' | |
| [ -e "$HOME/.nb-env/git-prompt.sh" ] && source "$HOME/.nb-env/git-prompt.sh"; || { wget https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh --no-check-certificate -P "$HOME/.nb-env" && source "$HOME/.nb-env/git-prompt.sh"; } | |
| ## color-ps1.sh by @nberlette | |
| ## I know, it's terrible |
| import * as React from 'react'; | |
| import { Text, View, StyleSheet } from 'react-native'; | |
| import Svg, { SvgProps, Use, Symbol, G, Path } from "react-native-svg" | |
| export default function BmwSvg(props: SvgProps) { | |
| return ( | |
| <Svg style={styles.logo} width="80%" height="80%" focusable="false" {...props}> | |
| <Use xmlnsXlink="http://www.w3.org/1999/xlink" xlinkHref="#icon-bmw-logo-gray"> | |
| <Symbol viewBox="0 0 340 340" id="icon-bmw-logo-gray" xmlns="http://www.w3.org/2000/svg"> | |
| <G fill="#6f6f6f"> |
| #!/usr/bin/env node | |
| // encryption.js by @nberlette | |
| const crypto = require('crypto') | |
| const algorithm = 'aes-256-cbc' | |
| const B32 = crypto.randomBytes(32) | |
| const B16 = crypto.randomBytes(16) | |
| const mkcipher = () => { |
| <script> | |
| function execPolyfill() { | |
| (function(){ | |
| // CustomElementsV1.min.js v1 polyfill from https://github.com/webcomponents/webcomponentsjs/tree/v1/src/CustomElements/v1. | |
| /* | |
| Copyright (c) 2016 The Polymer Project Authors. All rights reserved. | |
| This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt | |
| The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt |
| #!/usr/bin/env node | |
| import { createRequire } from "module" | |
| const require = createRequire(import.meta.url) | |
| const data = require("./data.json") | |
| /** | |
| * Cheerio Wrapper for HTMLRewriter on Cloudflare Workers® | |
| * | |
| * Usage of cheerio here only simulates stream-oriented parser! It is slow! | |
| */ | |
| import cheerio from 'cheerio' | |
| function replace(content, options) { | |
| this[0].nodeValue = content | |
| } |
| /** | |
| * Cheerio Wrapper HTMLRewriter.ts | |
| * | |
| * Usage of cheerio here only simulates stream-oriented parser! It is slow! | |
| * This typescript port hasn't been tested, and probably doesn't work. | |
| */ | |
| import cheerio from 'cheerio' |
| <?xml version="1.0" encoding="utf-8"?> | |
| <unattend xmlns="urn:schemas-microsoft-com:unattend"> | |
| <settings pass="oobeSystem"> | |
| <component name="Microsoft-Windows-International-Core" processorArchitecture="arm64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | |
| <InputLocale>0409:00000409</InputLocale> | |
| <SystemLocale>en</SystemLocale> | |
| <UILanguage>en-US</UILanguage> | |
| <UILanguageFallback>en-US</UILanguageFallback> | |
| <UserLocale>en</UserLocale> | |
| </component> |