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 / dl-file.php
Last active October 18, 2023 18:00 — forked from hakre/dl-file.php
File protection depending on ACF (Advanced custom fields) field.
<?php
/*
* dl-file.php
*
* Protect uploaded files with login.
*
* @link http://wordpress.stackexchange.com/questions/37144/protect-wordpress-uploads-if-user-is-not-logged-in
*
* @author hakre <http://hakre.wordpress.com/>
* @license GPL-3.0+
@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 / example-migration.ts
Last active April 30, 2021 00:00
MongoDB migrations with umzug in a FeathersJS application
import { Service } from '@feathersjs/feathers';
import { App } from '../src/app.interface';
import { Transformation } from '../src/services/transformations/transformations.interface';
export default {
up: async (app: App): Promise<boolean> => {
// Get service
const s: Service<Transformation> = app.service('transformations');
@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 = {