Skip to content

Instantly share code, notes, and snippets.

View georgestephanis's full-sized avatar

George Stephanis georgestephanis

View GitHub Profile
<?php
// Plugin name: Host Detection
/*
CREATE TABLE `shared_host_landing` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`host` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'The hosting company',
`hash` char(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'The md5 hash of the html landing page',
@georgestephanis
georgestephanis / limiter.php
Last active April 23, 2019 14:18
First, run `composer require google/apiclient:^2.0` on cli -- then get your credentials.json from the link in the file and drop this file in the folder. You WILL need to populate the two ID constants. They can be the same calendar if you really want, but I prefer to keep my blockers on a second hidden calendar to be tidier.
<?php
// credentials.json is gotten from https://developers.google.com/calendar/quickstart/php
define( 'EVENT_CALENDAR_ID', '' );
define( 'BLOCKER_CALENDAR_ID', '' );
define( 'WEEKS_TO_CHECK', 6 );
define( 'WEEKLY_LIMIT', 3 );
define( 'WEEK_IN_SECONDS', 7*24*60*60 );
define( 'TZ_P', substr_replace( trim( shell_exec( 'date +"%z"' ) ), ':', 3, 0 ) );
<?php
//
define( 'EVENT_CALENDAR_ID', '' );
define( 'BLOCKER_CALENDAR_ID', '' );
define( 'WEEKS_TO_CHECK', 6 );
define( 'WEEKLY_LIMIT', 3 );
define( 'WEEK_IN_SECONDS', 7*24*60*60 );
define( 'TZ_P', substr_replace( trim( shell_exec( 'date +"%z"' ) ), ':', 3, 0 ) );
Cheesecake: (take care of the pan)
Bake at 350 degrees 1 hour, 15 minutes (approximately)
Makes one 9"cake
Crust:
1 1/2 cups graham cracker crumbs (you can buy them already crushed)
3T sugar
1/2 t. cinnamon
1/4 c. (1/2 stick) butter, melted
Filling:
3 pkg. (8 oz each) cream cheese, room temperature

Your First Block

To make things simple, we're going to make a semi-structured way to display a mailing address.

We're going to start with a file tree that looks like this:

address-block
  ├ blocks
  | ├ address.jsx
@georgestephanis
georgestephanis / deploy-to-svn.sh
Created November 21, 2018 14:47
Make deploying from Git repositories to SVN a bit easier.
#!/bin/bash
if [ $# -eq 0 ]; then
echo "Run this script from within the root of the git repository that you'd like to deploy."
echo "You can only deploy something that's already been tagged in git."
echo 'Usage: `deploy-to-svn.sh <tag | HEAD>`'
exit 1
fi
GIT_DIR=$( pwd )
Index: trunk/hello.php
===================================================================
--- trunk/hello.php (revision 1975732)
+++ trunk/hello.php (working copy)
@@ -13,7 +13,7 @@
Text Domain: hello-dolly
*/
-function hello_dolly_get_lyric() {
+function hello_dolly_get_lyrics() {
<?php
add_action( 'admin_bar_menu', function( $wp_admin_bar ) {
$screen = get_current_screen();
if ( is_a( $screen, 'WP_Screen' ) ) {
$wp_admin_bar->add_node( [
'id' => 'screen_id',
'title' => sprintf( __( 'Screen ID: <kbd style="font-family: monospace; font-weight: 900;">%s</kbd>' ), esc_html( $screen->id ) ),
] );
<?php
define( 'MOODLE_USERNAME', '' );
define( 'MOODLE_PASSWORD', '' );
define( 'STUDENT_ID', '' );
define( 'MOODLE_DOMAIN', 'https://school.21cccs.org/' );
define( 'MOODLE_COOKIE_JAR', '/tmp/21cccs.cookiejar.txt' );
define( 'CLR_RESET', "\e[0m" );
<?php
/*
* Plugin Name: Hire With Google
*/
function Hire_With_Google_Shortcode( $atts ) {
// If we have a copy of the markup cached already, just display that version.
if ( $content = get_transient( 'meetmindfulcom_jobs' ) ) {
return $content;