Skip to content

Instantly share code, notes, and snippets.

View takeshi81's full-sized avatar

Takeshi Igarashi takeshi81

View GitHub Profile
/**
* パンくずからカテゴリー名を除去
*/
add_filter(
'snow_monkey_breadcrumbs',
function( $items ) {
if ( isset( $items[2] ) && preg_match( '/\/category\//', $items[2]['link'] ) ) {
array_splice( $items, 2, 1 );
}
return $items;
@takeshi81
takeshi81 / init.sh
Last active July 14, 2018 10:56
Nginx and PHP installation script for Debian 9 Stretch
#!/bin/sh
# Download and add Nginx signing key.
wget http://nginx.org/keys/nginx_signing.key
sudo apt-key add nginx_signing.key
# Add apt source
echo "deb http://nginx.org/packages/mainline/debian/ stretch nginx" | sudo tee -a /etc/apt/souces.list.d/nginx.list
wget -O sury.sh https://packages.sury.org/php/README.txt
#!/usr/bin/env bash
set -e
# リモートホスト設定
REMOTE_HOST='example.com'
REMOTE_PATH='/var/www/html'
REMOTE_URI='//example.com'
# ローカルホスト設定
@takeshi81
takeshi81 / detect-old-android.js
Last active April 19, 2016 16:19
Fast detection for Android. ( using String.prototype.indexOf, not RegExp )
var ua = navigator.userAgent.toLowerCase();
var isLollipop = ua.indexOf("android 5") > -1; // If Android 5.x is true
var isAndroid4x = ua.indexOf("android 4") > -1; // If Android 4.x is true
var isAndroid2x = ua.indexOf("android 2") > -1; // If Android 2.x is true
var isOldAndroid = isLollipop || isAndroid4x || isAndroid2x; // Return true if Android version is 5.x or older
if (isOldAndroid) {
// Write here.
}
@takeshi81
takeshi81 / install.sh
Last active March 17, 2016 14:46
Install Docker for IDCF Cloud Debian 8.2 based vritual machine.
#!/bin/sh
sudo apt-get update
sudo apt-get install -y apt-transport-https
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
sudo echo "deb https://apt.dockerproject.org/repo debian-jessie main" | sudo tee --append /etc/apt/sources.list.d/docker.list
sudo apt-get update
sudo apt-get install -y docker-engine
@takeshi81
takeshi81 / Vagrantfile
Last active March 17, 2016 13:53
Vagrant configuration for Debian 8 Jessie & Docker Engine
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
@takeshi81
takeshi81 / fetch-ogp.js
Last active January 13, 2016 21:39
Fetch new scrape open graph information via API (require jQuery).
var url = "https://graph.facebook.com/?id=" + window.location.href + "&scrape=true";
$.post( url );
@takeshi81
takeshi81 / dev.test.nginx.conf
Last active August 29, 2015 14:27
Nginx configuration installed via Homebrew
server {
listen [::]:8080;
listen 8080;
server_name ~^(.*)\.dev\.test$;
root /usr/local/var/www/$1;
index index.php index.html index.htm;
@takeshi81
takeshi81 / nginx.conf
Last active August 29, 2015 14:06 — forked from tmaiaroto/virtual.conf
A configuration files for homebrew users.
#user nginx nginx;
worker_processes 1;
error_log /usr/local/var/log/nginx/error.log debug;
pid /usr/local/var/run/nginx.pid;
events {
worker_connections 256;
}