Skip to content

Instantly share code, notes, and snippets.

Avatar

Christian Meunier tlvenn

View GitHub Profile
@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 Dec 27, 2021
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 \
@shahidv3
shahidv3 / harbor_tags_delete.sh
Last active Feb 7, 2021
Shell script to remove docker container files from Harbor
View harbor_tags_delete.sh
#!/bin/bash
## ##############################################################################################################################
## Author : Sahid Shaik shahids89@gmail.com #
## Usage: ./tags_delete.sh #
## Harbor images deletion is 2 step process #
## 1. Soft delete image using this script #
## 2. Run garbage collector #
## ##############################################################################################################################
@janeczku
janeczku / rke-etcd-secret-data-encryption.md
Created Apr 2, 2019
Rancher RKE etcd secrete data encryption
View rke-etcd-secret-data-encryption.md