Skip to content

Instantly share code, notes, and snippets.

View stevenroh's full-sized avatar
🇨🇭

Steven Roh stevenroh

🇨🇭
View GitHub Profile
@stevenroh
stevenroh / force-light-mode.php
Last active January 18, 2025 18:58
Force light mode for blockify theme
<?php
/*
* Plugin Name: Force light mode
* Plugin URI: https://stevenroh.ch
* Description: Force light mode for blockify theme
* Version: 0.1
* Author: Steven Roh
* Author URI: https://stevenroh.ch
*/
@stevenroh
stevenroh / block-button.html
Last active August 21, 2024 13:09
WP ACF binding
<!-- wp:buttons -->
<div class="wp-block-buttons">
<!-- wp:button {
"metadata":{
"bindings":{
"url":{
"source":"acf/field",
"args":{
"key":"url"
}
@stevenroh
stevenroh / example.spec.ts
Created June 21, 2023 08:15
Playwright screenshot on failure
import { screenshotOnFailure } from './helper';
test.afterEach(screenshotOnFailure);
@stevenroh
stevenroh / Auth.js
Created September 29, 2022 20:39 — forked from chadmuro/Auth.js
Supabase Auth Context
import React, { useContext, useState, useEffect, createContext } from 'react';
import { supabase } from '../supabase';
// create a context for authentication
const AuthContext = createContext();
export const AuthProvider = ({ children }) => {
// create state values for user data and loading
const [user, setUser] = useState();
const [loading, setLoading] = useState(true);
# Combines several solutions found on the internet
class ImplicitFTP_TLS(ftplib.FTP_TLS):
"""FTP_TLS subclass to support implicit FTPS."""
"""Constructor takes a boolean parameter ignore_PASV_host whether o ignore the hostname"""
"""in the PASV response, and use the hostname from the session instead"""
def __init__(self, *args, **kwargs):
self.ignore_PASV_host = kwargs.get('ignore_PASV_host') == True
super().__init__(*args, {k: v for k, v in kwargs.items() if not k == 'ignore_PASV_host'})
self._sock = None
@stevenroh
stevenroh / printAtoZ.html
Last active November 17, 2021 14:24
A to Z sheets
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Letter print sheet</title>
<style>
* {
padding: 0;
@stevenroh
stevenroh / logo.gif
Last active November 11, 2021 13:38
logo.gif
@stevenroh
stevenroh / favicon-grabbing-url-google.txt
Created November 11, 2021 10:55
Google favicon grabbing service
https://www.google.com/s2/favicons?sz=64&domain_url=yourdomain.here
@stevenroh
stevenroh / PiShrinkVagrantfile
Last active November 11, 2021 13:54
Run pishrink on new Ubuntu VM with Vagrant
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/trusty64"
# config.vm.synced_folder "P:\_IMAGES_ISO", "/vagrant_iso" # Use this line to mount a local folder on the Vagrant box
config.vm.provision "shell", inline: <<-SHELL
wget https://raw.githubusercontent.com/Drewsif/PiShrink/master/pishrink.sh
chmod +x pishrink.sh
sudo mv pishrink.sh /usr/local/bin
@stevenroh
stevenroh / functions.php
Created May 27, 2020 10:01
Custom slack_wpcf7_submit_message
<?php
/* $message — Default message to send to Slack
$form — Form object
$result — Array of result
*/
function custom_cf_7( $message, $form, $result ) {
return "OK" . json_encode($form) . json_encode($result); // Customize message here
}
add_filter( 'slack_wpcf7_submit_message', 'custom_cf_7', 10, 3 );