Skip to content

Instantly share code, notes, and snippets.

@tjtjtj
tjtjtj / main.go
Created February 20, 2020 11:31
go-kit amqp publish#1
package main
import (
"encoding/json"
"errors"
"log"
"net/http"
"github.com/go-kit/kit/endpoint"
"golang.org/x/net/context"
@tjtjtj
tjtjtj / .git_hooks_pre-commit
Last active December 16, 2015 06:35
git プレコミットフック
#!/bin/sh
# .git/hooks/pre-commit
php ./.git/hooks/rejection_pattern_check.php
if test $? -ne 0
then
echo "COMMIT REJECTED. Please remove them before commiting OR use --no-verify"
exit 1
fi
@tjtjtj
tjtjtj / gist:5574606
Last active December 17, 2015 07:39
VisualStudio2012 で Encode をUTF-8 without BOM にするAutoHotKey スクリプト
;;VisualStudio2012 ENCODE Change TO UTF-8 without BOM
F12::
send {F7}
send {Alt}f
send v
Sleep 500
send {TAB 2}
send {Alt}e
send {Down}
;; SELECT ENCODE
@tjtjtj
tjtjtj / EMultiSelectWidget.php
Created December 17, 2012 15:11
jquery-ui-multiselect-widget を YiiFramework Widget にします
<?php
/**
* EMultiSelectWidget
*
* <a href="http://www.erichynds.com/jquery/jquery-ui-multiselect-widget/">jquery-ui-multiselect-widget</a>を YiiFramework Widget にします。
*
* ファイルは次のように配置します。
* <pre>
* protected/extensions/emultiselectwidget/EMultiSelectWidget.php
* /assets/jquery.multiselect.js
@tjtjtj
tjtjtj / myphptales.php
Created April 12, 2012 12:48
PHPTALES if, eq
function phptal_tales_if( $src, $nothrow )
{
list($if_part, $right) = explode('?', $src, 3);
if (strpos($right,'|')) {
list($then_part, $else_part) = explode('|', $right, 2);
} else {
$then_part = $right;
$else_part = 'null';
}
return '('.phptal_tales($if_part, $nothrow).') ? '.phptal_tales($then_part, $nothrow).' : '.phptal_tales($else_part, $nothrow).'';
@tjtjtj
tjtjtj / PHPTALViewRenderer.php
Created April 5, 2012 13:49
PHPTAL View Renderer for YiiFramework
<?php
class PHPTALViewRenderer extends CApplicationComponent implements IViewRenderer
{
/**
* @var string Path alias to PHPTAL.php
*/
public $PHPTALPathAlias = 'application.vendors.PHPTAL';
/**
* @var string Template files extension