Skip to content

Instantly share code, notes, and snippets.

@adrienne
adrienne / mullenweg-wpe.md
Last active November 19, 2024 04:55
The Mullenweg/WPE Thing
@KevinBatdorf
KevinBatdorf / gutenberg-helpers.js
Last active July 17, 2024 14:36
WordPress check Gutenberg editor is ready
import { select, subscribe } from '@wordpress/data'
export function whenEditorIsReady() {
return new Promise((resolve) => {
const unsubscribe = subscribe(() => {
// This will trigger after the initial render blocking, before the window load event
// This seems currently more reliable than using __unstableIsEditorReady
if (select('core/editor').isCleanNewPost() || select('core/block-editor').getBlockCount() > 0) {
unsubscribe()
resolve()
@WesleyAC
WesleyAC / build.sh
Last active August 12, 2024 11:50
Simple rust build and deploy script — https://blog.wesleyac.com/posts/simple-deploy-script
#!/usr/bin/env bash
cd $(dirname $0)
docker run --rm -it -v "$(pwd)":/home/rust/src -v cargo-git:/home/rust/.cargo/git -v cargo-registry:/home/rust/.cargo/registry -v "$(pwd)/target/":/home/rust/src/target ekidd/rust-musl-builder:nightly-2021-01-01 sudo chown -R rust:rust /home/rust/.cargo/git /home/rust/.cargo/registry /home/rust/src/target
docker run --rm -it -v "$(pwd)":/home/rust/src -v cargo-git:/home/rust/.cargo/git -v cargo-registry:/home/rust/.cargo/registry -v "$(pwd)/target/":/home/rust/src/target ekidd/rust-musl-builder:nightly-2021-01-01 cargo build --release
@dbonillaf
dbonillaf / links_bonilista_458.md
Last active March 12, 2020 23:01
Links sobre la enseñanza de programación a niños
@Gerst20051
Gerst20051 / unflatten.php
Last active March 3, 2022 17:26
PHP Unflatten Dot Notation Array
<?
$results = [
'id' => 'abc123',
'address.id' => 'def456',
'address.coordinates.lat' => '12.345',
'address.coordinates.lng' => '67.89',
'address.coordinates.geo.accurate' => true,
];
@simov
simov / README.md
Last active October 8, 2024 11:55
Run `node` scripts using `nvm` and `crontab` without hardcoding the node version

Run node scripts using nvm and crontab without hardcoding the node version

cronjob.env.sh

#!/bin/bash

# NVM needs the ability to modify your current shell session's env vars,
# which is why it's a sourced function
@andyxmas
andyxmas / .lando.yml
Created January 4, 2018 20:43
wordpress lando
name: remadeagency
recipe: wordpress
config:
webroot: .
events:
post-db-import:
# Set PROD_URL and DEV_URL values in .env file
@kurlov
kurlov / mkv embed soft subtitles
Created December 16, 2017 23:41
ffmpeg command to add .srt based subtitles to an .mkv file
ffmpeg -i in.mkv -f srt -i in.srt -map 0:0 -map 0:1 -map 1:0 -c:v copy -c:a copy -c:s srt out.mkv
@dmpop
dmpop / unsplash-random.sh
Last active September 18, 2017 21:31
Use random photos from Unsplash as a desktop background on Ubuntu
#!/bin/bash
uuser="unsplash_user_name"
path="path/to/dir"
size=$(xdpyinfo | grep dimensions | awk '{print $2}')
curl "https://source.unsplash.com/user/$uuser/$size" --location --output $path/unsplash-random.jpeg
gsettings set org.gnome.desktop.background picture-uri file://$path/unsplash-random.jpeg
@justinshreve
justinshreve / woocommerce-cancel-unpaid-bookings.php
Created November 2, 2015 16:04
Allows WooCommerce booking orders to be canceled by the cancel unpaid orders cron job.
<?php
/*
* Plugin Name: Cancel Unpaid Bookings
* Author: WooThemes
* Description: Allows booking orders to be canceled by the cancel unpaid orders cron job.
*/
// woocommerce-cancel-unpaid-bookings.php
function woocommerce_cancel_unpaid_booking_orders_from_admin( $return, $order ) {