Skip to content

Instantly share code, notes, and snippets.

💭
😄

Takuro Hishikawa hissy

💭
😄
Block or report user

Report or block hissy

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
@hissy
hissy / concrete.php
Last active Sep 17, 2019
#concrete5 Disable getting external news and help from concrete5.org
View concrete.php
<?php
/**
* Put this file at application/config/concrete.php
* Disable getting external news, help and updates from concrete5.org
*/
return [
'marketplace' => [
'enabled' => false
],
'external' => [
@hissy
hissy / code-1.php
Last active Sep 12, 2019
Styling the pagination - 5.7
View code-1.php
<?php if ($showPagination): ?>
<?php echo $pagination;?>
<?php endif; ?>
@hissy
hissy / default.php
Created May 19, 2018
#concrete5 Minimum Foundation6 Theme
View default.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<!-- Compressed CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/foundation-sites@6.4.3/dist/css/foundation.min.css" integrity="sha256-GSio8qamaXapM8Fq9JYdGNTvk/dgs+cMLgPeevOYEx0= sha384-wAweiGTn38CY2DSwAaEffed6iMeflc0FMiuptanbN4J+ib+342gKGpvYRWubPd/+ sha512-QHEb6jOC8SaGTmYmGU19u2FhIfeG+t/hSacIWPpDzOp5yygnthL3JwnilM7LM1dOAbJv62R+/FICfsrKUqv4Gg==" crossorigin="anonymous">
<?php
View::element('header_required', [
'pageTitle' => isset($pageTitle) ? $pageTitle : '',
'pageDescription' => isset($pageDescription) ? $pageDescription : '',
@hissy
hissy / gist:7352933
Created Nov 7, 2013
[WordPress] Add file to media library programmatically
View gist:7352933
<?php
$file = '/path/to/file.png';
$filename = basename($file);
$upload_file = wp_upload_bits($filename, null, file_get_contents($file));
if (!$upload_file['error']) {
$wp_filetype = wp_check_filetype($filename, null );
$attachment = array(
'post_mime_type' => $wp_filetype['type'],
'post_parent' => $parent_post_id,
@hissy
hissy / concrete.php
Last active Sep 2, 2019
#concrete5 #5.7 How to work concrete5 behind a load balancer or a reverse proxy
View concrete.php
<?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
*/
@hissy
hissy / backlog-deploy.php
Last active Aug 16, 2019
Git Webhookを使ったCPIへのデプロイスクリプト
View backlog-deploy.php
<?php
// CPIユーザーID(契約情報で確認してください)
$user_id = 'abc123defg';
// リポジトリ名(Backlogで確認してください)
$repo_name = 'repository_name';
// Gitレポジトリの位置の指定
$git_dir = '/usr/home/' . $user_id . '/' . $repo_name . '.git';
// 展開先ディレクトリの指定
$work_tree = '/usr/home/' . $user_id . '/html';
// logファイルの指定
@hissy
hissy / app.php
Created Aug 8, 2019
#concrete5 Visualize rendering time of each blocks with DebugBar
View app.php
<?php
/**
* First, install the debug bar package. @link: https://github.com/concrete5cojp/concrete5_debugbar
* Then, add these code in your application/bootstrap/app.php
*/
Events::addListener('on_block_load', function ($event) {
$bID = $event->getArgument('bID');
$btHandle = $event->getArgument('btHandle');
Core::make('debugbar/time')->startMeasure(sprintf('block_%d', $bID), sprintf('Rendering %s block (bID: %d)', $btHandle, $bID));
});
@hissy
hissy / login.php
Last active Jul 29, 2019
#concrete5 Force specific authentication type by environment
View login.php
<?php
// Put this file on application/controllers/single_page/login.php
namespace Application\Controller\SinglePage;
use Concrete\Core\Routing\RedirectResponse;
use Concrete\Core\Support\Facade\Facade;
use Concrete\Core\Url\Resolver\Manager\ResolverManagerInterface;
class Login extends \Concrete\Controller\SinglePage\Login
@hissy
hissy / output.md
Last active Jul 12, 2019
#concrete5 Complete usage and output of Date Helper to localize date time format
View output.md
$dh = Core::make('helper/date');
Code en_US ja_JP it_IT ru_RU zh_CN
echo $dh->formatDateTime($date); 7/10/19, 7:28 AM 2019/07/10 7:28 10/07/19, 07:28 10.07.2019, 07:28 2019/7/10 上午7:28
echo $dh->formatDateTime($date, true); Jul 10, 2019, 7:28 AM 2019/07/10 7:28 10 lug 2019, 07:28 10 июл. 2019 г., 07:28 2019年7月10日 上午7:28
echo $dh->formatDateTime($date, false, true); 7/10/19, 7:28:21 AM 2019/07/10 7:28:21 10/07/19, 07:28:21 10.07.2019, 07:28:21 2019/7/10 上午7:28:21
echo $dh->formatDateTime($date, true, true); Jul 10, 2019, 7:28:21 AM 2019/07/10 7:28:21 10 lug 2019, 07:28:21 10 июл. 2019 г., 07:28:21 2019年7月10日 上午7:28:21
@hissy
hissy / valet.app.php
Last active Jul 11, 2019
#concrete5 config file for local environment
View valet.app.php
<?php
/**
* Set default value for curl option
*/
return [
'http_client' => [
'connecttimeout' => 30,
],
];
You can’t perform that action at this time.