Skip to content

Instantly share code, notes, and snippets.

View bootjp's full-sized avatar
🏠
Working from home

Yoshiaki Ueda (bootjp) bootjp

🏠
Working from home
View GitHub Profile
@bootjp
bootjp / nginx.conf
Created December 14, 2014 13:33
FC2ブログOSS版のNginxの設定
server {
listen 80;
server_name fc2blogtest.bootjp.me; #書き換えください
charset UTF-8;
access_log /var/log/nginx/fc2blogtest.bootjp.me.access.log main;
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Credentials true;
add_header Access-Control-Allow-Methods "POST, GET, OPTIONS";
add_header X-Frame-Options SAMEORIGIN;
add_header X-XSS-Protection "1; mode=block"; # 投稿時にControllerでX-XSS-Protection 0しているからないほうがいいかもしれない
@bootjp
bootjp / functions.php
Created January 6, 2015 14:10
WordPress SSL対応
<?php
function is_ssl() {
return true; // ←これを追記して無理やり処理
if ( isset($_SERVER['HTTPS']) ) {
if ( 'on' == strtolower($_SERVER['HTTPS']) )
return true;
if ( '1' == $_SERVER['HTTPS'] )
return true;
} elseif ( isset($_SERVER['SERVER_PORT']) && ( '443' == $_SERVER['SERVER_PORT'] ) ) {
return true;
@bootjp
bootjp / memo
Created January 21, 2015 13:58
さくらのVPS DISK I/O メモ 東京第二リージョン
[root@blog ~]# for n in `seq 1 19`; do hdparm -t /dev/vda1; sleep 60; done >sakuravps.log
[root@blog ~]# cat sakuravps.log
/dev/vda1:
Timing buffered disk reads: 46 MB in 3.04 seconds = 15.14 MB/sec
/dev/vda1:
Timing buffered disk reads: 24 MB in 3.19 seconds = 7.51 MB/sec
/dev/vda1:
@bootjp
bootjp / foreach.php
Last active August 29, 2015 14:14
PHP 5.5.14 foreach 内のポインタの挙動
<?php
$array = [
'key' => 'value',
'key2' => 'value2',
'key3' => 'value3',
'key4' => 'value4',
'key5' => 'value5'
];
@bootjp
bootjp / .gitignore_global
Last active August 29, 2015 14:16
.gitignore_global
*~
.DS_Store
nbproject/
nbactions.xml
nb-configuration.xml
nbactions-development.xml
nb-configuration
composer.lock
target/
vendor/
<?php
$time_start = microtime(true);
for ($i = 0; $i < 1000; ++$i) {
if (preg_match("/[0-9]+/", $i)) {
echo null;
}
}
@bootjp
bootjp / .bashrc
Created April 27, 2015 08:42
.bashrc
alias ll='ls -l'
source /usr/local/git/contrib/completion/git-prompt.sh
source /usr/local/git/contrib/completion/git-completion.bash
GIT_PS1_SHOWDIRTYSTATE=true
export PS1='\[\033[32m\]\u@\h\[\033[00m\]:\[\033[34m\]\w\[\033[31m\]$(__git_ps1)\[\033[00m\]\n\$ '
export HISTCONTROL=ignoredups:erasedups
export HISTSIZE=100000
export HISTFILESIZE=100000
shopt -s histappend
export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"
@bootjp
bootjp / ricty_autoinstall.sh
Created July 16, 2015 15:55
ricty_autoinstall
#!/bin/bash
brew install automake
brew install pkg-config
brew tap sanemat/font
brew install Caskroom/cask/xquartz
brew install ricty
cp -f /usr/local/Cellar/ricty/3.2.4/share/fonts/Ricty*.ttf ~/Library/Fonts/
@bootjp
bootjp / docker-machin_init.sh
Last active September 6, 2015 11:31
docker-machine,setup
$ docker-machine create -d virtualbox \
# --engine-insecure-registry oreore.repo.bootjp.me:5000 \
docker-machine-vm # enter (return)
## 出力
> docker-machine-vm
Creating VirtualBox VM...
Creating SSH key...
Starting VirtualBox VM...
Starting VM...
To see how to connect Docker to this machine, run: docker-machine env docker-machine-vm
@bootjp
bootjp / gist:d7634e9792b802825a77
Last active September 19, 2015 07:09 — forked from jonathanmoore/gist:2640302
Get the share counts from various APIs

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter