Skip to content

Instantly share code, notes, and snippets.

View katzueno's full-sized avatar

Katz Ueno katzueno

View GitHub Profile
@gatespace
gatespace / default.conf
Last active July 15, 2016 03:00
網元でWordPressの管理画面にアクセス制限(IP or Basic認証)をかける時に /etc/nginx/conf.d/default.conf に追記する内容
server {
# (略)
location ~* /wp-login\.php|/wp-admin/((?!admin-ajax\.php).)*$ {
index index.php index.html index.htm;
# 許可するIPアドレスを記述
allow 192.168.0.1;
deny all;
# Basic認証のメッセージ
@tao-s
tao-s / view.php
Last active August 29, 2015 13:57
A sample block view file for concrete5 add-on "Data".
<?php defined('C5_EXECUTE') or die("Access Denied.");
//Load Data models in package
Loader::model("data_list","data");
Loader::model("data_type","data");
//Create DataType object
$dataType = new DataType;
//load DataType by handle
$dataType->Load('dtHandle=?', array("object"));
@natelandau
natelandau / .bash_profile
Last active May 20, 2024 08:41
Mac OSX Bash Profile
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management
@hissy
hissy / concrete.php
Last active September 2, 2019 02:47
#concrete5 #5.7 How to work concrete5 behind a load balancer or a reverse proxy
<?php
/**
* Always trust incoming request.
*
* application/config/concrete.php
*
* For more detail, see: http://symfony.com/doc/current/cookbook/request/load_balancer_reverse_proxy.html
*/
@biojazzard
biojazzard / facebook_page_latest_post_no_php_sdk.php
Created March 6, 2016 11:32
Get Latest Post From a Facebook Page without PHP SDK (Graph Version v2.5)
<?php
/*
1.- Create an App.
2.- Go to: https://developers.facebook.com/tools/explorer/
+ Select your new created app on the right top.
+ Select "Get App Token"
@YuzuruSano
YuzuruSano / add_page_by_composer.php
Last active November 24, 2016 15:27
コンポーザーを通して新規ページを追加して、初期出力の記事ブロックに記事を挿入する。自動実行ジョブにどうぞ
<?php
//ページタイプの「出力」で'Main'エリアにコンポーザーで扱うcontentブロックを入れてる場合
$pageType = \PageType::getByHandle('ページタイプハンドル');
$template = $pageType->getPageTypeDefaultPageTemplateObject();
$d = $pageType->createDraft($template);
$d->setPageDraftTargetParentPageID(親ページID);
$pageType->savePageTypeComposerForm($d);
$pageType->publish($d);
//$dには追加したページオブジェクトが入ってくる
@hissy
hissy / app.php
Created April 9, 2017 07:22
[concrete5] [V8] Add password validation rule
<?php
// application/bootstrap/app.php
/** @var \Concrete\Core\Validator\ValidatorManagerInterface $passwordValidator */
$passwordValidator = Core::make('validator/password');
/** @var \Concrete\Core\Validator\String\RegexValidator $regexValidator */
$regexValidator = Core::make(
\Concrete\Core\Validator\String\RegexValidator::class,
['/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d).+$/']
);
@hissy
hissy / ManualNavPublisher.php
Last active May 1, 2020 09:15
[concrete5][V8][MigrationTool] Example of creating custom publisher
<?php
// application/src/Concrete/MigrationTool/Publisher/Block/ManualNavPublisher.php
namespace Application\Concrete\MigrationTool\Publisher\Block;
use Concrete\Core\Block\Block;
use Concrete\Core\Page\Page;
use PortlandLabs\Concrete5\MigrationTool\Entity\Import\Batch;
use PortlandLabs\Concrete5\MigrationTool\Entity\Import\BlockValue\BlockValue;
use PortlandLabs\Concrete5\MigrationTool\Publisher\Block\PublisherInterface;
@hissy
hissy / scan_duplicate_file_name.php
Last active April 11, 2017 06:02
[concrete5][Legacy] Find duplicate file name and change it
<?php
class ScanDuplicateFileName extends QueueableJob
{
public $jNotUninstallable=0;
public $jSupportsQueue = true;
public function getJobName()
{
return t('Scan Duplicate File Name');
@hissy
hissy / import_files.php
Last active May 16, 2017 20:45
[concrete5][V8] Search all files from legacy database, then import files to modern concrete5
<?php
namespace Application\Job;
use Concrete\Core\File\Importer;
use Concrete\Core\Job\QueueableJob;
use ZendQueue\Message as ZendQueueMessage;
use ZendQueue\Queue as ZendQueue;
class ImportFiles extends QueueableJob
{