Skip to content

Instantly share code, notes, and snippets.

View hissy's full-sized avatar
💭
😄

Takuro Hishikawa hissy

💭
😄
View GitHub Profile
@hissy
hissy / wp-query-ref.php
Last active May 1, 2023 01:53 — forked from luetkemj/wp-query-ref.php
WP: Query $args
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
* Japanese translated by hissy
*
* CODEX: http://wpdocs.sourceforge.jp/%E9%96%A2%E6%95%B0%E3%83%AA%E3%83%95%E3%82%A1%E3%83%AC%E3%83%B3%E3%82%B9/WP_Query#.E3.83.91.E3.83.A9.E3.83.A1.E3.83.BC.E3.82.BF
* Source: https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/query.php
* Original: https://gist.github.com/luetkemj/2023628/9e911982440141a13cb1dd8ba1ad6b35cd7bbdd7
*/
@hissy
hissy / backlog-deploy.php
Last active April 11, 2023 02:04
Git Webhookを使ったCPIへのデプロイスクリプト
<?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 / gist:0b8df0149fbba16be08d
Last active March 21, 2023 02:15
[Really Simple CSV Importer] 画像をインターネットからダウンロードして投稿に添付し、画像のIDをカスタムフィールドに登録
<?php
/*
Plugin Name: Really Simple CSV Importer Action add-on
Description: Run the additional action after importing the post data
Author: Takuro Hishikawa
Version: 0.1
*/
class rscsvimporter_action {
// singleton instance
@hissy
hissy / really-simple-csv-importer-addon.php
Created February 25, 2015 14:01
[Really Simple CSV Importer] Example: import image from url to custom field
<?php
/*
Plugin Name: Get Remote Image to Custom Field
*/
add_filter('really_simple_csv_importer_post_saved', function($post)
{
if (is_object($post)) {
// Get the meta data of which key is "image"
$image = $post->image;
@hissy
hissy / bulk_move_pages
Last active March 17, 2023 03:57
Automated job to move all pages under old parent to new parent
<?php
namespace Application\Job;
use Concrete\Core\Job\QueueableJob;
use Concrete\Core\Page\Page;
use Concrete\Core\Page\PageList;
use ZendQueue\Message as ZendQueueMessage;
use ZendQueue\Queue as ZendQueue;
class BulkMovePages extends QueueableJob
@hissy
hissy / clear_empty_workflow_progress.php
Last active March 14, 2023 19:58
[concrete5] A job to deletes empty "Compare Versions" alerts.
<?php
namespace Application\Job;
use Job as AbstractJob;
use Concrete\Core\Workflow\Progress\PageProgress;
use Concrete\Core\Workflow\EmptyWorkflow;
class ClearEmptyWorkflowProgress extends AbstractJob
{
@hissy
hissy / delete_uncompleted_processes.php
Last active February 28, 2023 11:12
[Concrete CMS] Delete Uncompleted Processes
<?php
$app = \Concrete\Core\Support\Facade\Application::getFacadeApplication();
/** @var \Doctrine\ORM\EntityManagerInterface $em */
$em = $app->make(\Doctrine\ORM\EntityManagerInterface::class);
/** @var \Concrete\Core\Entity\Command\ProcessRepository $repository */
$repository = $em->getRepository(\Concrete\Core\Entity\Command\Process::class);
$processes = $repository->findRunning();
/** @var \Concrete\Core\Command\Process\ProcessUpdater $updater */
$updater = $app->make(\Concrete\Core\Command\Process\ProcessUpdater::class);
@hissy
hissy / FileItem.php
Created February 15, 2023 12:24
[Concrete CMS] [Migration Tool] Inspect file by fvTitle instead of fvFilename
<?php
// application/src/Backup/ContentImporter/ValueInspector/Item/FileItem.php
namespace Application\Backup\ContentImporter\ValueInspector\Item;
use Concrete\Core\File\File;
class FileItem extends \Concrete\Core\Backup\ContentImporter\ValueInspector\Item\FileItem
{
@hissy
hissy / site.php
Last active February 15, 2023 03:09
[Concrete CMS] Change Ckeditor DTD settings
<?php
// application/config/site.php
// https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_dtd.html
$dtd = <<<END
CKEDITOR.dtd['a']['div'] = 1;
END;
return [
'sites' => [
@hissy
hissy / map.js
Created March 26, 2012 04:00
Show Multiple Markers on Google Map from JSON
jQuery(document).ready(function(){
jQuery("#map").each(function(){
SpotSearchMap = new SpotSearchMapObj(36.5626,136.362305, 8);
});
});
var Marker;
var SpotSearchMap;
var SpotSearchMapObj = Class.create();
SpotSearchMapObj.prototype = {