Skip to content

Instantly share code, notes, and snippets.

View zerobias's full-sized avatar
💭
Set your status

Dmitry zerobias

💭
Set your status
View GitHub Profile
@addyosmani
addyosmani / README.md
Last active April 2, 2024 20:18 — forked from 140bytes/LICENSE.txt
108 byte CSS Layout Debugger

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version

@jordwalke
jordwalke / existentialTypes.ml
Created August 12, 2015 06:41
Existential Types Recovering
type printable = Printable : 'a * ('a-> string) -> printable;;
let myList = [Printable (2, string_of_int); Printable (true, string_of_bool)];;
let printPrintable: printable -> string = fun p ->
let Printable (data, printer) = p in
printer data
;;
let printables = [Printable (2, string_of_int); Printable (true, string_of_bool)];;
let results = List.map printPrintable printables;;
@gaearon
gaearon / slim-redux.js
Last active May 5, 2024 15:14
Redux without the sanity checks in a single file. Don't use this, use normal Redux. :-)
function mapValues(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
result[key] = fn(obj[key], key);
return result;
}, {});
}
function pick(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
if (fn(obj[key])) {
@markerikson
markerikson / redux-thunk-examples.js
Last active September 4, 2022 11:12
Redux-Thunk examples
// The classic AJAX call - dispatch before the request, and after it comes back
function myThunkActionCreator(someValue) {
return (dispatch, getState) => {
dispatch({type : "REQUEST_STARTED"});
myAjaxLib.post("/someEndpoint", {data : someValue})
.then(
response => dispatch({type : "REQUEST_SUCCEEDED", payload : response}),
error => dispatch({type : "REQUEST_FAILED", error : error})
);
@A-gambit
A-gambit / REACTIVE2016-LIGHTNING-PROPOSAL.md
Last active February 22, 2024 18:24
Proposal for lightning talk at ReactiveConf 2016: Road from UndefinedLand

Proposal for a lightning talk at the Reactive 2016.

Keep calm and like/retweet it on Twitter and star this Gist to vote on this talk.

Road from UndefinedLand

Undefiend

I work at Grammarly. We like React and happily use it in our applications. However, sometimes something goes wrong and bugs creep into the code. Here comes testing. It helps make us confident about the quality of our code.

@sebmarkbage
sebmarkbage / asyncToReact.js
Last active March 31, 2023 15:57
Convert Async Function to React Component
function asyncToReact(fn) {
class PromiseComponent extends React.Component {
state = { waiting: true, result: null };
componentDidMount() {
fn(...this.props.args).then(result => this.setState({ waiting: false, result }));
}
componentDidUpdate() {
fn(...this.props.args).then(result => this.setState({ waiting: false, result }));
}
shouldComponentUpdate(newProps) {
# for json
import json
from collections import OrderedDict
# for tl
import re
import struct
import binascii
__all__ = [
@DrBoolean
DrBoolean / representable.js
Last active December 24, 2020 00:15
Representable Functors
const Immutable = require('immutable-ext')
const {Just, Nothing} = require('data.maybe')
const Task = require('data.task')
// Setup
const Reader = f =>
({
run: f,
map: g => Reader(x => g(f(x))),
@kana-sama
kana-sama / haskell.json
Last active July 19, 2021 14:11
List of snippets for vscode for Haskell Unicode functions and tokens
{
"α": { "body": "α", "prefix": "\\alpha" },
"β": { "body": "β", "prefix": "\\beta" },
"γ": { "body": "γ", "prefix": "\\gamma" },
"δ": { "body": "δ", "prefix": "\\delta" },
"ζ": { "body": "ζ", "prefix": "\\zeta" },
"η": { "body": "η", "prefix": "\\eta" },
"θ": { "body": "θ", "prefix": "\\theta" },
"ι": { "body": "ι", "prefix": "\\iota" },
"κ": { "body": "κ", "prefix": "\\kappa" },
@stek29
stek29 / 0readme.md
Last active April 11, 2022 17:59
proof of concept
git clone https://github.com/grishka/libtgvoip.git
cd libtgvoip
# Build openssl-1.0.1 and opus-1.1 to prefix libraries/
# Save CMakeLists.txt here (in repo root)
mkdir build
cd build
# Save CallMakefile and main.cpp here