Skip to content

Instantly share code, notes, and snippets.

@epicfaace
epicfaace / typeahead.jsx
Last active September 21, 2019 04:28
rjsf typeahead
import React from "react";
import { Typeahead } from 'react-bootstrap-typeahead';
import 'react-bootstrap-typeahead/css/Typeahead.css';
export default class extends React.Component {
render() {
const { id, onChange, options, value } = this.props;
const { enumOptions, enumDisabled } = options;
return (<Typeahead
id={id}
selected={value ? [value]: []}
.full-width {
left: 50%;
margin-left: -50vw;
margin-right: -50vw;
max-width: 100vw;
position: relative;
right: 50%;
width: 100vw;
}
@epicfaace
epicfaace / compare.py
Created August 24, 2019 22:04
compare times
import timeit
code1 = """
import array
value = "\u00e4\u00bd\u00a0\u00e5\u00a5\u00bd\u00e4\u00b8\u0096\u00e7\u0095\u008c\u00f0\u009f\u0098\u008a"
array.array('B', [ord(char) for char in value]).tostring().decode()
"""
code2 = r"""
value = b'\xe4\xbd\xa0\xe5\xa5\xbd\xe4\xb8\x96\xe7\x95\x8c\xf0\x9f\x98\x8a'
value.decode()
"""
<style>
.cff-msc-header-container {
font-family: 'Open Sans';
font-size: 16px;
text-transform: none;
line-height: normal;
}
.cff-msc-header {
color: #ec6b33;
{
"title": "<style>.cff-msc-header-container * { font-family: 'Open Sans'; font-size: 16px; text-transform: none; line-height: normal;} .cff-msc-header{color: #ec6b33; font-weight: bold; text-transform: capitalize; font-size: 24px; font-family: Verdana; text-align: center;}</style><a target=_blank href='https://chinmayaaradhana2020.org'><img class='img-fluid' style='float:left;max-width:200px' src=https://chinmayaaradhana2020.org/wp-content/uploads/2019/06/MSC_2020_LOGO_LightBG-3.png /></a><div class='cff-msc-header-container'><div class='cff-msc-header'>27th Chinmaya Mahasamadhi Aradhana Camp<br>“2020 - THE PERFECT VISION”</div><div style='float: center; text-align: center'>Thursday July 30th – Monday Aug 3rd, 2020<br>Hyatt Regency, 1333 Bayshore Highway, Burlingame, California, United States, 94010</div><br style='clear: both' /></div>",
"description": "<div style='text-align:center; font-family: 'Open Sans'; font-size: 18px; margin-top: 20px'><strong>REGISTRATION FORM</strong></div><br><div>All registr
@epicfaace
epicfaace / reflect.py
Last active August 20, 2019 04:48
好好儿的reflection code
#!/usr/bin/env python
# (Python 2)
# Reflects the requests from HTTP methods GET, POST, PUT, and DELETE
# Written by Nathan Hamiel (2010)
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
from optparse import OptionParser
class RequestHandler(BaseHTTPRequestHandler):
@epicfaace
epicfaace / download
Created August 17, 2019 22:36
codalab db insert
curl https://gist.githubusercontent.com/epicfaace/266324286be9759e7fc028091c923987/raw/fd0f896f9a9c783a0c10b215ad4588627201d65e/gistfile1.txt
@epicfaace
epicfaace / .js
Created June 21, 2019 17:04
Replace sponsorship levels
x = {...}
JSON.stringify(x).replace(/Silicon/g, "OONE").replace(/Platinum/g, "TTWO").replace(/Gold/g, "TTHREE").replace(/silicon/g, "oone").replace(/platinum/g, "ttwo").replace(/gold/g, "tthree").replace(/OONE/g, "Gold").replace(/TTWO/g, "Silver").replace(/TTHREE/g, "Bronze").replace(/oone/g, "gold").replace(/ttwo/g, "silver").replace(/tthree/g, "bronze")
@epicfaace
epicfaace / gist:13b4f7e2f88ae012a00be1c2aba42e89
Created June 20, 2019 15:50
idea - json patch and immutability helper
Could we convert JSON patch to an immutability-helper operation, so that the entire data does not need to be cloned? https://github.com/Starcounter-Jack/JSON-Patch
- email client like news site
-