Skip to content

Instantly share code, notes, and snippets.

View bitflower's full-sized avatar

Matthias Max bitflower

View GitHub Profile
@bitflower
bitflower / my-plugins.js
Created March 23, 2024 13:00
Simple Rollup plugin starter
// import { createFilter } from 'rollup-pluginutils'
function assign(target, source) {
Object.keys(source).forEach((key) => {
target[key] = source[key];
});
return target;
}
// const DEFAULT_HEADER = 'import React from \'react\';'
@bitflower
bitflower / Info.plist
Created August 16, 2022 14:36
Enable app's files on iOS
<key>LSSupportsOpeningDocumentsInPlace</key>
<true/>
<key>UIFileSharingEnabled</key>
<true/>
@bitflower
bitflower / authentication.ts
Last active July 4, 2022 21:30
Use 3rd party token in FeathersJS
let moduleExports = (app: Application) => {
const authentication = new AuthenticationService(app);
// authentication.register('jwt', new JWTStrategy());
// authentication.register('local', new LocalStrategy());
// authentication.register('google', new GoogleStrategy());
authentication.register('microsoft', new MicrosoftStrategy()); // TODO: Let add from the cloud-app?
// authentication.register('microsoft', new OidcStrategy());
@bitflower
bitflower / app.ts
Last active July 7, 2021 14:45
Use `shoelace` in a Stencil project
// src/global/app.ts
import { setup } from './vendor/shoelace';
export default async function (): Promise<void> {
setup();
}
@bitflower
bitflower / readme.md
Created May 7, 2021 10:55
Capacitor Live Reload on Android (fix ERR_CLEARTEXT_NOT_PERMITTED)
@bitflower
bitflower / readme.md
Created May 7, 2021 07:07
Best Javascript date parse description

The 2014-03-03T... notation is a fancy JavaScript Date Time String Format and expects a time zone. If you don't provide one, it defaults to Z (UTC).

The 2014-03-03 18:30:00 notation, however, is just a regular string without an interesting name and, if you don't provide a time zone, it assumes local time.

This info was taken from the MDN article about Date.parse().

Link: https://stackoverflow.com/questions/22151477/javascript-iso-8601-string-into-date-object

@bitflower
bitflower / Info.plist
Last active February 3, 2021 16:57
App-specific file sharing (iOS and Android)
...
<key>UIFileSharingEnabled</key>
<true/>
<key>LSSupportsOpeningDocumentsInPlace</key>
<true/>
...
@bitflower
bitflower / client.ts
Last active December 16, 2020 20:32
node-opcua server for API binding with configuration via JSON file
import { OPCUAClient, OPCUAClientOptions } from 'node-opcua';
import { CO_OPCUA_CLIENT_DEFAULTS } from './client-defaults';
import { CoOPCUAClientConfig } from '../config';
let client: OPCUAClient;
export const createClient = (options: CoOPCUAClientConfig) => {
const optionsCombined: OPCUAClientOptions = {
@bitflower
bitflower / my-chart.tsx
Created November 26, 2020 16:02
Using Chart.js in Stencil
import { Chart } from 'chart.js';
@Component({
tag: 'chart-js',
styleUrl: 'chart-js.scss'
})
export class ChartJs {
@Prop()
public data: any;
@Watch('data')
@bitflower
bitflower / st-generate.js
Created November 17, 2020 05:58
Stencil Generate Script
/*
To setup, place in scripts/st-generate.js and add
"st:generate": "node scripts/st-generate.js"
To your npm scripts.
To generate a component in src/components/ run
npm run st:generate component my-component