Skip to content

Instantly share code, notes, and snippets.

Avatar
🌮

Josh Pollock Shelob9

🌮
View GitHub Profile
View batch-cli.php
<?php
function batch_cli( $command, $totalPages,$loop ) {
$state = new \stdClass();
$state->page = 1;
$state->totalPages = $totalPages;
$state->command = $command;
$createProcess = function($state){
return new Process(sprintf( "%s --page=%n", $state->command, $state->page );
};
View pasteEventHandler.js
{
paste(evt) {
console.log('on paste', evt.clipboardData.items[0].toString());
},
}
@Shelob9
Shelob9 / roy.tsx
Created Aug 22, 2020
Simple React context example, with TypeScript. See: https://codesandbox.io/s/react-context-tldr-bey3y
View roy.tsx
const RoyContext = React.createContext<{
hi: boolean;
setHi: (set: boolean) => void;
}>(null);
const RoyProvider = ({ children }) => {
const [hi, setHi] = useState<boolean>(true);
return (
<RoyContext.Provider value={{ hi, setHi }}>{children}</RoyContext.Provider>
);
View error.sh
TypeError
Cannot read property 'length' of undefined
at QuickInserter (https://u8k01.csb.app/node_modules/
wordpress/block-editor/build-module/components/inserter/quick-inserter.js:80:59
renderWithHooks
https://u8k01.csb.app/node_modules/react-dom/cjs/react-dom.development.js:14803:18
mountIndeterminateComponent
https://u8k01.csb.app/node_modules/react-dom/cjs/react-dom.development.js:17482:13
beginWork
https://u8k01.csb.app/node_modules/react-dom/cjs/react-dom.development.js:18596:16
View addQueryArgs.js
function(endpoint,args={}){
//parse url
//https://developer.mozilla.org/en-US/docs/Web/API/URL
let url = new URL(endpoint);
//Add params
Object.keys(args).forEach( arg => {
//https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams/URLSearchParams
url.searchParams.append( arg, args[arg] );
});
View keybase.md

Keybase proof

I hereby claim:

  • I am shelob9 on github.

  • I am josh412 (https://keybase.io/josh412) on keybase.

  • I have a public key ASCT2BGcVt7nW9uRSYmEN6v5BekpxFqeGw0JF3I_qSKpkwo

View cf-editor.js
(function () {
jQuery(document).on("field.config-change", (e, update) => {
let { name, value } = update;
console.log(name, value);
});
jQuery(document).on("field.removed", (e, data) => {
const { fieldId } = data;
console.log(fieldId);
});
View docker-compose.yml
gitlab-runner:
image: gitlab/gitlab-runner:alpine
volumes:
- ./gitlab/config.toml:./config.toml
View DOCKERFILE
FROM wordpress
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer