Skip to content

Instantly share code, notes, and snippets.

Avatar

Christian Meunier tlvenn

View GitHub Profile
@gaetschwartz
gaetschwartz / settings.json
Last active Sep 8, 2022
Nest files in Flutter projects on VSCode, inspired from https://github.com/antfu/vscode-file-nesting-config
View settings.json
"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 Sep 26, 2022
Setting up Emporia Vue 2 with ESPHome
View Setting up Emporia Vue 2 with ESPHome.md

Setting up Emporia Vue 2 whole-home power monitor with ESPHome

Changelog
  • 2022-07-30: add home assistant instructions & MQTT FAQ.
  • 2022-07-16: mention using UART adaptor's RTS pin, thanks to @PanicRide
  • 2022-07-02: mention mqtt is now supported
  • 2022-04-30: bump software version number to 2022.4.0
  • 2022-05-04: mention 64-bit ARM issues in FAQ
@roipeker
roipeker / main.dart
Created Jun 4, 2021
GraphX issue #19: simpler gesture transform (zoom, drag, rotate)
View main.dart
/// 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());
}
View textspan_mouse_cursor.dart
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 Sep 4, 2022
Current list of spy pixels named'n'shamed in HEY, as of April 23, 2020
View tracker_blocking.rb
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 Nov 10, 2019
Gatsby, TailwindCSS, Storybook configuration
View .storybook
- addons.js
- config.js
- webpack.config.js
@sibelius
sibelius / useSubmit.tsx
Created Oct 31, 2019
useSubmit hook to make sure you don't call onSubmit twice
View useSubmit.tsx
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 Sep 19, 2019
ErrorBoundaryWithRetry to be used with relay useQuery hook
View ErrorBoundaryWithRetry.tsx
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 Aug 11, 2021
Example showing how to useFormik and FormikProvider
View FormUseFormik.tsx
type Props = {
};
const FormUseFormik = (props: Props) => {
const { enqueueSnackbar } = useSnackbar();
const onSubmit = (values) => {
enqueueSnackbar(`submit: ${JSON.stringify(values)}`, {
preventDuplicate: true,
persist: false,
});
@nicbet
nicbet / Dockerfile
Created Jun 27, 2019
Elixir 1.9 Releases Alpine Linux Docker Multi-Stage Build
View Dockerfile
# ---- Build Stage ----
FROM erlang:22-alpine AS app_builder
# Set environment variables for building the application
ENV MIX_ENV=prod \
TEST=1 \
LANG=C.UTF-8
# Fetch the latest version of Elixir (once the 1.9 docker image is available you won't have to do this)
RUN set -xe \