Skip to content

Instantly share code, notes, and snippets.

@liudonghua123
liudonghua123 / esm-package.md
Created April 7, 2024 03:04 — forked from sindresorhus/esm-package.md
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@liudonghua123
liudonghua123 / main.dart
Last active September 15, 2022 08:31
add some operator override on Set date type
// https://www.geeksforgeeks.org/python-set-operations-union-intersection-difference-symmetric-difference/
// https://dart.cn/guides/language/extension-methods#implementing-generic-extensions
// https://api.dart.cn/stable/2.18.1/dart-core/Set-class.html
extension EhancedSet<T> on Set<T> {
Set<T> operator |(Set<T> anotherSet) => union(anotherSet);
Set<T> operator &(Set<T> anotherSet) => intersection(anotherSet);
Set<T> operator -(Set<T> anotherSet) => difference(anotherSet);
Set<T> operator ^(Set<T> anotherSet) => union(anotherSet).difference(intersection(anotherSet));
}
@liudonghua123
liudonghua123 / repl.dart
Created September 8, 2022 02:01 — forked from maks/repl.dart
Example of basic Dart REPL using vm_service package
import 'dart:developer' as dev;
import 'dart:io';
import 'package:vm_service/vm_service.dart' show InstanceRef, VmService;
import 'package:vm_service/vm_service_io.dart' as vms;
import 'package:vm_service/utils.dart' as vmutils;
// based on early version of:
// https://github.com/BlackHC/dart_repl/
// and example in:
// https://github.com/dart-lang/sdk/blob/master/pkg/vm_service/example/vm_service_tester.dart
@liudonghua123
liudonghua123 / pyside_dynamic.py
Created September 6, 2022 04:34 — forked from cpbotha/pyside_dynamic.py
pyside_dynamic.py with minor improvements - also see http://stackoverflow.com/a/14894550/532513
#!/usr/bin/python2
# -*- coding: utf-8 -*-
# Copyright (c) 2011 Sebastian Wiesner <lunaryorn@gmail.com>
# Modifications by Charl Botha <cpbotha@vxlabs.com>
# * customWidgets support (registerCustomWidget() causes segfault in
# pyside 1.1.2 on Ubuntu 12.04 x86_64)
# * workingDirectory support in loadUi
# found this here:
# https://github.com/lunaryorn/snippets/blob/master/qt4/designer/pyside_dynamic.py
@liudonghua123
liudonghua123 / idb-backup-and-restore.md
Created August 4, 2022 18:39 — forked from loilo/idb-backup-and-restore.js
Back up and restore an IndexedDB database

Back up and restore an IndexedDB database

This gist is an ES module which provides functions to import and export data from an IndexedDB database as JSON. It's based on Justin Emery's indexeddb-export-import package, but applies some adjustments that reflect better on the current browser landscape (i.e. better developer ergonomics but no support for Internet Explorer).

Usage

For each of the provided functionalities, you need a connected IDBDatabase instance.

Export Data

import { idb } from 'some-database'
@liudonghua123
liudonghua123 / django-branches-svn2git.rst
Created May 11, 2022 01:35 — forked from ramiro/django-branches-svn2git.rst
Importing Django branches from SVN to Git{,Hub}?

Importing Django branches (and merges) from SVN to our GitHub repo

Versions used:

$ svn --version
svn, version 1.6.17 (r1128011)
compiled Nov 20 2011, 03:42:58
...
@liudonghua123
liudonghua123 / For Mac 4.2.6 unlimited trial.md
Created May 5, 2022 05:05 — forked from rise-worlds/For Mac 4.2.6 unlimited trial.md
Beyond Compare 4 license for Windows, Mac, Linux

for 4.2.4 or higher,4.2.5,4.2.6,4.3.7,it's works , this is the way which makes Always in evaluation mode 。

  1. open Terminal, go to the dir : cd /Applications/Beyond Compare.app/Contents/MacOS
  2. change the name BCompare to BCompare.bak: mv BCompare BCompare.bak
  3. touch a file name BCompare , and chmod a+u BCompare : touch BCompare && chmod a+u BCompare
  4. open BCompare with text editor, insert the script :
#!/bin/bash
rm "/Users/$(whoami)/Library/Application Support/Beyond Compare/registry.dat"
"`dirname "$0"`"/BCompare.bak $@
@liudonghua123
liudonghua123 / SMBDIS.ASM
Created April 29, 2022 08:40 — forked from 1wErt3r/SMBDIS.ASM
A Comprehensive Super Mario Bros. Disassembly
;SMBDIS.ASM - A COMPREHENSIVE SUPER MARIO BROS. DISASSEMBLY
;by doppelganger (doppelheathen@gmail.com)
;This file is provided for your own use as-is. It will require the character rom data
;and an iNES file header to get it to work.
;There are so many people I have to thank for this, that taking all the credit for
;myself would be an unforgivable act of arrogance. Without their help this would
;probably not be possible. So I thank all the peeps in the nesdev scene whose insight into
;the 6502 and the NES helped me learn how it works (you guys know who you are, there's no
@liudonghua123
liudonghua123 / echarts_demo.ipynb
Last active January 6, 2022 14:34
echarts_demo.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.