Skip to content

Instantly share code, notes, and snippets.

@shumiyao
shumiyao / items.md
Last active September 8, 2023 21:58
Panic Bag

Food

  • sausages
  • tuna
  • canned sardines
  • Ready meal cans
  • toast
  • salty and sugary biscuits
  • protein bars
  • jars of fruit purees and ready-to-eat meals
  • marmalade or jam
// Convert unicode string to Javascript escape
// https://stackoverflow.com/questions/21014476/javascript-convert-unicode-string-to-javascript-escape
String.prototype.toUnicode = function(){
var result = "";
for(var i = 0; i < this.length; i++){
// Assumption: all characters are < 0xffff
result += "\\u" + ("000" + this[i].charCodeAt(0).toString(16)).substr(-4);
}
return result;
};
@shumiyao
shumiyao / gist:3b597864fd40bbcc7d2756f690281910
Last active February 9, 2023 23:27
Shortcode Test for StaticCMS (warning: this is a work in progress and incomplete)
interface TestShortcodeProps {
src: string;
}
CMS.registerShortcode<TestShortcodeProps>('test', {
label: 'test',
openTag: '[',
closeTag: ']',
separator: '|',
toProps: (args) => {
@shumiyao
shumiyao / UuidControl.tsx
Last active January 28, 2023 19:46
Uuid Control widget for Static CMS
// reference https://github.com/antondb/netlify-cms-widget-uuid
import React from 'react';
import type { WidgetControlProps } from '@staticcms/core';
interface UuidField {
name: 'uuid';
widget: 'uuid';
}
const createUuid = (options = { size: 8, url: 'int8rdomaluesbj012345679cfghkpqvwxyzZ' }) => {
cd template-lookbook (in your mac)
git branch -m paywall main;
git fetch origin;
git branch -u origin/main main;
git remote set-head origin -a;
git branch;
git checkout main;
import 'package:flutter/material.dart';
final Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
@shumiyao
shumiyao / gist:c27148ee66ec6f3c8cccf6ee9a5d0d59
Created March 24, 2021 21:22
Logic Pro Bluetooth Midi keyboard disconnection bug Log When it happened
default 21:12:16.548397+0000 bluetoothd Stop scanning for process sharingd (454) with scan request of type 16, blob: {length = 0, bytes = 0x}, mask {length = 0, bytes = 0x}, active: 0, duplicates: 0, screen on: No Scan, screen off: No Scan, locked: 1, rssi: -90, peers: (
) nearby scan mode: 10, adv buf: 0, advbuf mode: 4, priority critical: 0, range: 0
default 21:12:16.548481+0000 bluetoothd Removing scan request scan request of type 16, blob: {length = 0, bytes = 0x}, mask {length = 0, bytes = 0x}, active: 0, duplicates: 0, screen on: No Scan, screen off: No Scan, locked: 1, rssi: -90, peers: (
) nearby scan mode: 10, adv buf: 0, advbuf mode: 4, priority critical: 0, range: 0 for client 2FCCBE14-0721-4677-B445-AF5245A5477B
default 21:12:16.548607+0000 bluetoothd Passively scanning for devices of types: 5 15 18 (Window: 30/Interval: 300)
default 21:12:16.548646+0000 bluetoothd About to scan for type: 15 - rssi: -70 - range: 0 - payload: {length = 22, bytes = 0x00000000000000000000000000000000000000000000} -
@shumiyao
shumiyao / gist:e2a6aab2829eb044c782df330ec6b25c
Created February 14, 2021 20:59
Dart: add value to Map conditionally by using spread
void main() {
bool test = false;
Map<String, String> myMapA = {
"a": "1",
"b": "2",
... test == true ? {"c":"3"} : {}
};
Map<String, String> myMapB = {
"a": "1",
"b": "2",
@shumiyao
shumiyao / index.js
Created June 13, 2020 17:15
Netlify CMS registerWidget ~ select box (not working)
CMS.registerWidget(
'predefined_labels',
createClass({
getDefaultProps: function () {
return {
value: ''
}
},
componentDidMount: async function () {
// const _field = this.props.field;
@shumiyao
shumiyao / gist:a3a59983434163b093bd4c53e696b879
Created May 29, 2020 12:30
Final Cut Pro 10.4.8 + MVVK2 + 10.15.5
Process: Final Cut Pro [3482]
Path: /Applications/Final Cut Pro.app/Contents/MacOS/Final Cut Pro
Identifier: com.apple.FinalCut
Version: 10.4.8 (358560)
Build Info: ProEditor-35856000076000000~7 (15B18c)
App Item ID: 424389933
App External ID: 833677189
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Final Cut Pro [3482]