Skip to content

Instantly share code, notes, and snippets.

View tlvenn's full-sized avatar

Christian Meunier tlvenn

  • Hong Kong
  • 21:33 (UTC +08:00)
  • X @tlvenn
View GitHub Profile
@lukepighetti
lukepighetti / .zshrc
Last active April 9, 2024 11:59
zsh functions I use for Helix / Flutter development
function flutter-watch(){
local PID_FILE="/tmp/tf$$.pid"
tmux new-session \;\
send-keys "flutter run --pid-file=$PID_FILE" Enter \;\
split-window -v \;\
send-keys "npx -y nodemon -e dart -x \"cat $PID_FILE | xargs kill -s USR1\"" Enter \;\
resize-pane -y 5 -t 1 \;\
select-pane -t 0 \;
rm $PID_FILE;
}
@gaetschwartz
gaetschwartz / settings.json
Last active February 17, 2025 14:27
Nest files in Flutter projects on VSCode, inspired from https://github.com/antfu/vscode-file-nesting-config
"explorer.fileNesting.enabled": true,
"explorer.fileNesting.expand": false,
"explorer.fileNesting.patterns": {
"pubspec.yaml": ".flutter-plugins, .packages, .dart_tool, .flutter-plugins-dependencies, .metadata, .packages, pubspec.lock, build.yaml, analysis_options.yaml, all_lint_rules.yaml",
".gitignore": ".gitattributes, .gitmodules, .gitmessage, .mailmap, .git-blame*",
"readme.*": "authors, backers.md, changelog*, citation*, code_of_conduct.md, codeowners, contributing.md, contributors, copying, credits, governance.md, history.md, license*, maintainers, readme*, security.md, sponsors.md",
"*.dart": "$(capture).g.dart, $(capture).freezed.dart",
},
@flaviut
flaviut / Setting up Emporia Vue 2 with ESPHome.md
Last active August 22, 2024 18:14
Setting up Emporia Vue 2 with ESPHome
@roipeker
roipeker / main.dart
Created June 4, 2021 19:54
GraphX issue #19: simpler gesture transform (zoom, drag, rotate)
/// live demo: https://graphx-gesture-simple.surge.sh
import 'package:flutter/material.dart';
import 'package:graphx/graphx.dart';
import 'package:graphx_zoompan/simple_zoom.dart';
void main() {
runApp(AppSimpleZoom());
}
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart' as urlLauncher;
void main() => runApp(App());
class App extends StatelessWidget {
static const title = 'Flutter App';
@override
Widget build(BuildContext context) => MaterialApp(
@dhh
dhh / tracker_blocking.rb
Last active June 30, 2024 14:35
Current list of spy pixels named'n'shamed in HEY, as of April 23, 2020
module Entry::TrackerBlocking
extend ActiveSupport::Concern
included do
has_many :blocked_trackers
end
email_service_blockers = {
"ActiveCampaign" => /lt\.php(.*)?l\=open/,
"AWeber" => "openrate.aweber.com",
@romansorin
romansorin / .storybook
Created November 10, 2019 00:52
Gatsby, TailwindCSS, Storybook configuration
- addons.js
- config.js
- webpack.config.js
@sibelius
sibelius / useSubmit.tsx
Created October 31, 2019 19:17
useSubmit hook to make sure you don't call onSubmit twice
import { useState, useRef, useCallback } from 'react';
export const useSubmit = (fun: Function) => {
const [isPending, setIsPending] = useState<boolean>(false);
const pendingRef = useRef(null);
const submit = useCallback((...args) => {
if (pendingRef.current) {
return;
}
@sibelius
sibelius / ErrorBoundaryWithRetry.tsx
Created September 19, 2019 22:19
ErrorBoundaryWithRetry to be used with relay useQuery hook
class ErrorBoundaryWithRetry extends React.Component<Props, State> {
state = {error: null};
static getDerivedStateFromError(error): State {
return {error: error};
}
_retry = () => {
this.setState({error: null});
}
@sibelius
sibelius / FormUseFormik.tsx
Last active March 10, 2025 03:04
Example showing how to useFormik and FormikProvider
type Props = {
};
const FormUseFormik = (props: Props) => {
const { enqueueSnackbar } = useSnackbar();
const onSubmit = (values) => {
enqueueSnackbar(`submit: ${JSON.stringify(values)}`, {
preventDuplicate: true,
persist: false,
});