Skip to content

Instantly share code, notes, and snippets.

@Hu-Wentao
Hu-Wentao / AHK-hjkl
Last active December 14, 2024 16:33
AHK-v2 空格+HJKL脚本
; =============================================
; ----- Move -----
Space & h:: {
Send "{Blind}{Left}"
}
Space & j:: {
Send "{Blind}{Down}"
}
Space & k:: {
Send "{Blind}{Up}"
@mewben
mewben / flutter_icon_rotate.dart
Created October 30, 2019 07:03
Flutter: Rotate Icon by 90 degrees
import 'package:flutter/material.dart';
import 'dart:math';
class RotatedIcon extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Transform.rotate(
angle: 90 * pi/180,
child: Icon(Icons.flight),
);
@niusounds
niusounds / deep_merge_map.dart
Last active January 28, 2026 01:28
Map deep merge in Dart.
Map<String, dynamic> deepMergeMap(Map<String, dynamic> a, Map<String, dynamic> b) {
b.forEach((k, v) {
if (!a.containsKey(k)) {
a[k] = v;
} else {
// TODO handle List type
if (a[k] is Map) {
deepMergeMap(a[k], b[k]);
} else {
a[k] = b[k];
@gatopeich
gatopeich / dataclass_from_dict.py
Created February 19, 2019 15:08
Python 3.7 dataclass to/from dict/json
from dataclasses import dataclass, fields as datafields
from ujson import dumps, loads
# Note: ujson seamlessly serializes dataclasses, unlike stdlib's json
@dataclass
class Point:
x: float
y: float
# Shallow dataclass can be rebuilt from dict/json: