I hereby claim:
- I am esamattis on github.
- I am esamatti (https://keybase.io/esamatti) on keybase.
- I have a public key whose fingerprint is 5049 677F 4375 E9F0 42BD E964 475F 6384 8C75 40AE
To claim this, I am signing this object:
{ | |
"profiles": [ | |
{ | |
"complex_modifications": { | |
"rules": [ | |
{ | |
"manipulators": [ | |
{ | |
"description": "Section to Backtick (MS keyboard)", | |
"from": { |
<?php | |
/** | |
* WordPress does automatic HTML entity encoding but so does React which | |
* results in double encoding. This reverts the one from WordPress when | |
* the content is requested using wp-graphql making your life as a React | |
* dev easier. | |
* | |
*/ | |
class HTMLEntities |
I hereby claim:
To claim this, I am signing this object:
<?php | |
namespace WPNext; | |
/** | |
* WordPress does automatic HTML entity encoding but so does React which | |
* results in double encoding. | |
* | |
* But since Headup is only used with React we can decode the entities using | |
* PHP and let React do it's encoding thing. |
<?php | |
class TranslationStrings | |
{ | |
function __construct() | |
{ | |
if (!\function_exists('pll_translate_string')) { | |
return; | |
} |
const wait = t => new Promise(resolve => setTimeout(resolve, t)); | |
class Dataloader { | |
constructor() { | |
this.pending = {}; | |
} | |
async load(id) { | |
return new Promise(resolve => { | |
this.pending[id] = resolve; |
<?php | |
/** | |
* Add graphql root query for getting unique meta values for a given post type | |
*/ | |
class UniqMetaValues { | |
function init() { | |
add_action( 'graphql_register_types', [ $this, 'register_types' ], 10, 0 ); | |
} |
import React from "react"; | |
type ClassNamePrimitive = string | false | undefined | null; | |
interface ClassNamesFunction<Props> { | |
(props: Props): ClassNamePrimitive | ClassNamePrimitive[]; | |
} | |
interface ClassNamesDict<Props> { | |
[className: string]: boolean | ((props: Props) => boolean); |
type BuildMeasures<T extends string> = { | |
[K in T]: {count: number; duration: number} | |
}; | |
export class AvgCalculator<T extends string> { | |
private measures: BuildMeasures<T>; | |
constructor(keys: T[]) { | |
const measures = {} as BuildMeasures<T>; |
import {Client, SearchParams} from "elasticsearch"; | |
/** | |
* Iterate all search results one by one with async iteration without reading | |
* it all to memory | |
*/ | |
async function* scrollSearch<Document>(esClient: Client, params: SearchParams) { | |
let res = await esClient.search<Document>(params); | |
while (true) { |