This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
######################################################################## | |
# Pre-configured WordPress Installation for local PHP/node development # | |
# For development & testing only, use in production not recommended. # | |
######################################################################## | |
FROM wordpress:latest | |
LABEL author=hsimah | |
LABEL author_uri=https://github.com/hsimah-services |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"global": { | |
"check_for_updates_on_startup": true, | |
"show_in_menu_bar": true, | |
"show_profile_name_in_menu_bar": false | |
}, | |
"profiles": [ | |
{ | |
"complex_modifications": { | |
"parameters": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Move-ByDate { | |
param( | |
$Path = '.', | |
$Destination | |
) | |
Get-ChildItem -Path $Path | ForEach-Object { | |
$Date = $_.LastWriteTimeUtc | Get-Date -f yyyy.M | |
$DestPath = Join-Path $Destination $Date |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Join-Path will handle trailing slashes or lack thereof | |
Join-Path -Path $Branch -ChildPath $Leaf | |
# Other useful functions include: | |
[IO.Path]::GetDirectoryName() # Gets the directory name | |
[IO.Path]::GetFileName() # Gets the file name | |
[IO.Path]::GetFileNameWithoutExtension() # Gets the file name sans extension | |
[IO.Path]::GetExtension() # Gets the file extension including leading . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Resolves a relative path | |
# throws an exception if path doesn't exist | |
$Path | Resolve-Path | Select-Object -ExpandProperty Path |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Clean a filename | |
$Path.Split([IO.Path]::GetInvalidFileNameChars()) -join '_' | |
# Clean a directory path | |
$Path.Split([IO.Path]::GetInvalidPathChars()) -join '_' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'graphql_data_is_private', function( $is_private, $model_name, $data ) { | |
if ( $model_name === 'PostObject' ) { | |
if ( $data->post_type === 'tutorial' ) { | |
$user_id = get_current_user_id(); | |
if ( ! rcp_user_can_access( $user_id, $data->ID ) ) return true; | |
if ( ! rcp_is_active( $user_id ) ) return true; | |
// TODO update RCP and stop using deprecated rcp_is_active | |
// if ( ! rcp_user_has_active_membership( $user_id ) ) return true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE `ps_edgeusertut` ( | |
`ID` int(11) unsigned NOT NULL, | |
`ut_userid` text COLLATE utf8mb4_unicode_520_ci NOT NULL, | |
`ut_tutorial` text COLLATE utf8mb4_unicode_520_ci NOT NULL, | |
`ut_faved` tinyint(1) DEFAULT NULL, | |
`ut_datefaved` text COLLATE utf8mb4_unicode_520_ci NOT NULL, | |
`ut_unlocked` tinyint(1) DEFAULT NULL, | |
`ut_dateunlocked` text COLLATE utf8mb4_unicode_520_ci NOT NULL, | |
`ut_watched` tinyint(1) DEFAULT NULL, | |
`ut_watch_history` text COLLATE utf8mb4_unicode_520_ci NOT NULL, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'posts_clauses', function( $clauses, $query_object ) { | |
global $wpdb; | |
$user_id = get_current_user_id(); | |
if ( ! array_key_exists('graphql_args', $query_object->query ) ) { | |
return $clauses; | |
} | |
switch ( $query_object->query['post_type'] ) { | |
case 'tutorial': | |
$joined = false; | |
if ( ! array_key_exists( 'where', $query_object->query['graphql_args'] ) ) { |