Skip to content

Instantly share code, notes, and snippets.

View stevenroh's full-sized avatar
🇨🇭

Steven Roh stevenroh

🇨🇭
View GitHub Profile
@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 );
@stevenroh
stevenroh / functions.php
Created April 7, 2020 08:40
Display map
<?php /* Template Name: Carte */
function page_content() {
?>
<div class="map">
<?php
$args = array(
'post_type' => 'poi'
);
$the_query = new WP_Query( $args );
@stevenroh
stevenroh / functions.php
Last active November 9, 2021 09:45
Disable gutenberg/new editor for CPT
<?php
add_filter('use_block_editor_for_post_type', 'prefix_disable_gutenberg', 10, 2);
function prefix_disable_gutenberg($current_status, $post_type) {
if ($post_type === 'cpt1') return false;
if ($post_type === 'cpt2') return false;
if ($post_type === 'cpt3') return false;
return $current_status;
}