Skip to content

Instantly share code, notes, and snippets.

View hirayama-evolni's full-sized avatar

hirayama-evolni

View GitHub Profile
@hirayama-evolni
hirayama-evolni / receive_dialog_close.js
Last active November 12, 2015 06:03
外部URLのiframeで開いたダイアログを閉じるためのもの
$(function(){
"use strict";
// メッセージを受け取ってダイアログを閉じる
$(window).on("message", function(e){
var message = e.originalEvent.data;
message = JSON.parse(message);
if(message.message == "CLOSE_DIALOG"){
// 使うプラグインによって変えてください。
$.magnificPopup.close();
@hirayama-evolni
hirayama-evolni / Vagrantfile
Last active August 29, 2015 14:26
とりあえずLAMPを上げるVagrantfile
# coding: utf-8
# -*- mode: ruby -*-
# vi: set ft=ruby :
# 必要なもの:
# Oracle VirtualBox https://www.virtualbox.org/
# Vagrant https://www.vagrantup.com/
#
# それぞれダウンロード&インストールしてください。
# VagrantはC:\HashiCorp\Vagrant\binにPATHを通す必要があるかも知れません。
@hirayama-evolni
hirayama-evolni / rsync_backup.md
Last active August 29, 2015 14:26
rsyncのバックアップオプションのテスト

jQueryのgitリポジトリで実験

$ mkdir ../backup_test
$ git checkout 1.8.0
$ rsync -v -a --exclude=node_modules --exclude=.git . ../backup_test/current
$ find ../backup_test/current/|sort > ../a
$ git checkout 1.8.1
# -bのみ … 同じ場所に~がついてバックアップされる
$ rsync -b -a --exclude=node_modules --exclude=.git . ../backup_test/current
$ find ../backup_test/current/|sort > ../b
@hirayama-evolni
hirayama-evolni / zipsearch.php
Last active August 29, 2015 14:23
郵便番号検索ライブラリ
<?php
/*
* 郵便番号検索ライブラリ
* (C) EVOLNI
* (C) Wataru Hirayama
* License: MIT
*
* Version: 1.0.0
*
C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.1/plugins/providers/virtualbox/driver/base.rb:387:in `gsub': invalid byte sequence in UTF-8 (ArgumentError)
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.1/plugins/providers/virtualbox/driver/base.rb:387:in `execute'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.1/plugins/providers/virtualbox/driver/version_4_3.rb:251:in `read_forwarded_ports'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.1/plugins/providers/virtualbox/driver/version_4_3.rb:456:in `block in read_used_ports'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.1/plugins/providers/virtualbox/driver/version_4_3.rb:449:in `each'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.1/plugins/providers/virtualbox/driver/version_4_3.rb:449:in `read_used_ports'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.1/plugins/providers/virtualbox/action/prepare_forwarded_port_collision_params.rb:12:in `call'
name="IE9 - Win7"
groups="/"
ostype="Windows 7 (32 bit)"
UUID="a422b326-ca31-4d5f-8acd-2e1f47644f55"
CfgFile="C:\\Users\\hirayama\\VirtualBox VMs\\IE9 - Win7\\IE9 - Win7.vbox"
SnapFldr="C:\\Users\\hirayama\\VirtualBox VMs\\IE9 - Win7\\Snapshots"
LogFldr="C:\\Users\\hirayama\\VirtualBox VMs\\IE9 - Win7\\Logs"
hardwareuuid="a422b326-ca31-4d5f-8acd-2e1f47644f55"
memory=512
pagefusion="off"
@hirayama-evolni
hirayama-evolni / gist:f2afc102afc57745ff7b
Created September 17, 2014 05:53
Laravelで、cssとjsをbladeに通す
// cssとjs
function tmptmp_proc_assets($path, $is_css)
{
if ($is_css) {
// css
$content_type = 'text/css';
} else {
// js
$content_type = 'text/javascript';
}
@hirayama-evolni
hirayama-evolni / test.php
Last active August 29, 2015 14:03
PHPで日本語メール
<?php
$subject = "てすと";
$body = <<<END
ほんぶん1
ほんぶん2
ほんぶん3
ほんぶん4
ほんぶん5
@hirayama-evolni
hirayama-evolni / gist:3278246d7fc097fff9f7
Created July 2, 2014 09:08
TortoiseHgで、ファイルを既定のアプリで開く設定例
[editor-tools]
start.executable = cmd
start.args = /C start "" $FILE
[editor-patterns]
**.gif = start
**.jpg = start
**.png = start
@hirayama-evolni
hirayama-evolni / gist:828ac8f4f69ac884feae
Created June 17, 2014 04:06
fancybox-1.3.4を新しめのjQuery&Migrateと使う時にinlineで出してるところが消える現象の回避方法
$(function(){
// 上位の(オリジナルの)関数
var orig_func = jQuery.event.trigger;
// 上書きする
jQuery.event.trigger = function(event, data, elem, onlyHandlers){
/*** fancyboxからの呼び出しを特別扱いする ***/
if(/^fancybox-/.test(event)){
// 全要素に対してeventを発火する(fancyboxが期待している動作)
var el = $("body *"), ret;