Skip to content

Instantly share code, notes, and snippets.

@mairh
mairh / Redux-Form-Semantic-UI-React
Last active August 12, 2021 23:03
Semantic-UI-React form validation using redux-form example
// semantic-ui-form.js
import React from 'react';
import PropTypes from 'prop-types';
import { Form, Input } from 'semantic-ui-react';
export default function semanticFormField ({ input, type, label, placeholder, meta: { touched, error, warning }, as: As = Input, ...props }) {
function handleChange (e, { value }) {
return input.onChange(value);
}
@jamescasbon
jamescasbon / template.py
Created December 11, 2011 16:37
Pure python templates using with statement
"""
A really stupid python template language inspired by coffeekup, markaby.
Do not use this code, it will ruin your day. A byproduct of insomnia.
TL;DR
-----
This module defines a template language that allows us to do:
d = Doc()
@etorreborre
etorreborre / gist:1353640
Created November 10, 2011 00:14
Using different Monoids to extract the max value / max cumulated value on some records, for a given key
/**
* The methods below can be used to extract significant values in log records. For example, we might want to get:
*
* - the maximum execution time per method call
* - the maximum execution time per server
* - the maximum memory consumption per method call
* - the maximum memory consumption per server
*
* - the maximum cumulated execution time per method call
* - the maximum cumulated execution time per server