Skip to content

Instantly share code, notes, and snippets.

View k4zuki02h4t4's full-sized avatar
🏠
家で働く

KAZUKI Otsuhata k4zuki02h4t4

🏠
家で働く
View GitHub Profile
@mono0926
mono0926 / commit_message_example.md
Last active May 10, 2024 09:02
[転載] gitにおけるコミットログ/メッセージ例文集100
@gregrickaby
gregrickaby / social-sharing-with-javascript-popup.php
Last active October 21, 2019 02:33
Social Sharing with Javascript Pop-up
<?php
/**
* Social sharing links.
*/
function wds_client_get_social_share_links( ) {
$facebook_url = 'https://www.facebook.com/sharer/sharer.php?u=' . rawurlencode ( get_the_permalink() );
$twitter_url = 'https://twitter.com/intent/tweet?text=?text=' . urlencode( html_entity_decode( get_the_title() ) ) . '&amp;url=' . rawurlencode ( get_the_permalink() );
$linkedin_url = 'https://www.linkedin.com/shareArticle?mini=true&amp;url=' . rawurlencode ( get_the_permalink() ) . '&amp;title=' . urlencode( html_entity_decode( get_the_title() ) );
@willerce
willerce / ResLoader.js
Last active July 3, 2018 14:01
保存 Javascript 和 CSS 到 LocalStorage 中
var Loader = (function () {
function Loader(options) {
this.options = options;
if (resource.scripts && resource.baseUrl) {
for (var i = 0; i < this.options.scripts.length; i++) {
this.load('js', this.options.scripts[i]);
}
for (var i = 0; i < this.options.stylesheets.length; i++) {
this.load('css', this.options.stylesheets[i]);
}
@torounit
torounit / _ide-helper.php
Created June 18, 2015 04:29
PHPStorm等でWordPressのグローバル変数の入力補完を有効にする。プロジェクトのどこかに置いておくと補完されるようになる。
<?php
trigger_error("This file should not be included, only analyzed by your IDE", E_USER_ERROR);
$wp_the_query = new WP_Query();
/** @var WP_Query $wp_query */
$wp_query = $wp_the_query;
$wp_rewrite = new WP_Rewrite();
$wp = new WP();
@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ファイルの指定
@wokamoto
wokamoto / gist:048b93a4c87b86b184d6
Last active November 24, 2015 03:22
[WordPress] git 管理しているテーマでバージョンとして git のコミットIDをバージョン番号として使用するサンプル
<?php
$version = 'default';
$stylesheet_dir = get_stylesheet_directory();
if ( file_exists( $stylesheet_dir.'/.git/HEAD' ) ) {
$head = explode(' ', trim(file_get_contents($stylesheet_dir.'/.git/HEAD')) );
if ( isset($head[1]) && file_exists($stylesheet_dir.'/.git/'.$head[1]) ) {
$version = trim(file_get_contents($stylesheet_dir.'/.git/'.$head[1]));
}
}
define( 'THEME_VERSION', $version );
@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;
@torounit
torounit / Admin_Column_Custom_Field.php
Last active February 29, 2016 14:39
WordPressの投稿一覧にカスタムフィールドを表示する。並び替えにも対応。
<?php
Class Admin_Column_Custom_Field {
/** @var string */
private $field_key;
/** @var string */
private $field_label;
@averyvery
averyvery / spread.sass
Last active May 16, 2020 22:07
spread.sass
// strip-units required by spread mixin
// http://stackoverflow.com/questions/12328259/how-do-you-strip-the-unit-from-any-number-in-sass
@function strip-units($number)
@return $number / ($number * 0 + 1)
// pow and sqrt required by ease function
// adapted from https://github.com/at-import/Sassy-math/blob/master/sass/math.scss
@function pow($base, $exponent)
$value: $base
@tegansnyder
tegansnyder / hhvm_magento_setup.md
Last active July 14, 2023 22:30
HHVM Magento Server Setup

I've had the opertunity to try a variety of different server configurations but never really got around to trying HHVM with Magento until recently. I thought I would share a detailed walkthrough of configuring a single instance Magento server running Nginx + Fast CGI + HHVM / PHP-FPM + Redis + Percona. For the purpose of this blog post I'm assuming you are using Fedora, CentOS, or in my case RHEL 6.5.

Please note: I'm 100% open to suggestions. If you see something I did that needs to be done a different way, please let me know. I haven't included my Perconca my.conf file yet. I will shortly. Also I plan on trying this same test with HHVM 3.3 and PHP 7.

Install the EPEL, Webtatic, and REMI repos

rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm