Skip to content

Instantly share code, notes, and snippets.

George Stephanis georgestephanis

Block or report user

Report or block georgestephanis

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View mtgax.php
<?php
define( 'MTGA_LANG', 'EN' );
define( 'MTGA_PATH', '/Applications/MTGArena.app/Contents/Resources/drive_c/Program Files/Wizards of the Coast/MTGA' );
define( 'MTGA_LOGS', MTGA_PATH . '/MTGA_Data/Logs/Logs' );
define( 'MTGA_DATA', MTGA_PATH . '/MTGA_Data/Downloads/Data' );
// Get all the logs!
$logs = glob( MTGA_LOGS . '/UTC_Log - * - 1.htm' );
View Stephanis.Scan.php
<?php
// Should this use RecursiveDirectoryIterator instead?
namespace Stephanis\Scan;
trait Props {
public $modified;
public $owner;
public $group;
View clean_company_names_to_slugs.php
<?php
function python_slug( $str ) {
$str = Normalizer::normalize( $str, Normalizer::FORM_KD );
$str = preg_replace( '~[\x00-\x1F\x80-\xFF]~', '', $str );
$str = preg_replace( '~[^\w\s-]~', '', $str );
$str = strtolower( trim( $str ) );
return preg_replace( '~[-\s]+~', '-', $str );
}
View slug.slug.php
<?php
/*
* This is meant to be a port of the Python `slug.slug()` method, the
* source of which is as follows:
*
* value = unicodedata.normalize('NFKD', value).encode('ascii', 'ignore')
* value = re.sub('[^\w\s-]', '', value.decode('utf-8')).strip().lower()
* return re.sub('[-\s]+', '-', value)
*/
View gist-to-gsheet.php
<?php
/**
* Plugin Name: Grunion to Google Sheets
*/
require __DIR__ . '/vendor/autoload.php';
define( 'SPREADSHEET_ID', '' );
View host-detection.php
<?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 Apr 23, 2019
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.
View limiter.php
<?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 ) );
View limiter.php
<?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 ) );
View Cheesecake.txt
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
View your-first-block.md

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
You can’t perform that action at this time.