Skip to content

Instantly share code, notes, and snippets.

@mcorkum
mcorkum / test.json
Last active July 13, 2023 02:32
WordPress - Overriding Gutenberg text strings with translations
{
"domain": "messages",
"locale_data": {
"messages": {
"": {
"domain": "messages"
},
"This block contains unexpected or invalid content.": [
"Poop, this block sucks now"
]
<?php
class Threader
{
private array $tweets, $roots;
private string $user;
public function handle(): void
{
echo "What is your twitter username? ";
import type { FunctionComponent } from "react";
export const combineProviders = (providers: FunctionComponent[]) => providers.reduce(
(Combined, Provider) => ({ children }) => (
<Combined>
<Provider>{children}</Provider>
</Combined>
),
);
<?php
namespace {{ factoryNamespace }};
use Illuminate\Database\Eloquent\Factories\Factory;
use {{ namespacedModel }};
/**
* @method {{ model }}|\Illuminate\Support\Collection<{{ model }}> create($attributes = [], ?Model $parent = null)
* @method \Illuminate\Support\Collection<{{ model }}> createMany(iterable $records)
@daaru00
daaru00 / template.yml
Created July 8, 2021 14:44
A SAM template that describe an Amazon CloudFront distribution that serve a static website from an S3 Bucket.
AWSTemplateFormatVersion: 2010-09-09
Transform:
- AWS::Serverless-2016-10-31
# Template Information
Description: "Personal Website"
# Template Parameters
<?
//
// AUTO KEYWORD-BASED FOLLOWER CURATION BOT (by @levelsio)
//
// File: twitterFollowerCuratorBot.php
//
// Created: May 2021
// License: MIT
//
name: Pull Request Check
on:
workflow_dispatch:
inputs:
body:
default: ""
test:
default: "false"
pull_request_target:
@threepointone
threepointone / after.js
Last active February 4, 2021 09:30
converted a function to a generator; simpler, more efficient, cooler.
// recursively get all files in a folder
function* getAllFiles(dirPath: string): Iterable<string> {
for (const file of fs.readdirSync(dirPath)) {
const pathToCheck = path.join(dirPath, file);
if (fs.statSync(pathToCheck).isDirectory()) {
if (file !== 'node_modules') {
yield* getAllFiles(pathToCheck);
}
} else {
yield pathToCheck;
// get all tweets from @prisma
from:prisma
// tweets between two accounts
from:ryanchenkie to:chris__sev
// tweets by a hashtag but only with images
#InaugurationDay filter:images
// keywords by people on a specific list
@tobi
tobi / kindle.rb
Last active September 25, 2022 02:37
Download your Kindle Highlights to local markdown files. Great for Obsidian.md.
#!/usr/bin/env ruby
# gem install active_support
require 'active_support/inflector'
require 'active_support/core_ext/string'
# gem install webrick (only ruby3)
require 'webrick'
# gem install mechanize