Skip to content

Instantly share code, notes, and snippets.

@honbin
honbin / hubot_of_hipchat_on_heroku.md
Last active August 29, 2015 14:02
herokuにhubotをhipchatで使った時のコマンド手順
@honbin
honbin / process_killer.sh
Created June 12, 2014 10:31
プロセス殺したいとき
#!/bin/bash
PS=`pgrep -lf "${1:?引数に殺したいプロセス名を渡してね}"`
echo $PS
if [ -z "${PS}" ]; then
echo "殺したいプロセス名は存在しないようですね、ウィー"
exit 1
fi
(function($){
$(window).bind("beforeunload", function(e) {
var params = {};
$(":input").each(function(){
params[this.name] = this.value;
});
$.post("/hoge", params, function(result) {
//success
});
});
@honbin
honbin / gist:6635109
Created September 20, 2013 09:20
入力フォームに変更があったかどうかで、スタイルを適用する
(function($) {
$(":input").change(function(e) {
//e.target.type で入力タイプとれる(text, textarea, radio, select-one)ので
//※それぞれの入力タイプで適用する場合は条件分岐で
//変更があった場合にスタイルを適用する場合は $(this).removeClass("hogehgoe") etc..
}
}(jQuery));
var LocalStorage = LocalStorage || (function() {
var LOCAL_STORAGE_KEY = "key";
var connect = function() {
if (!localStorage.hasOwnProperty(LOCAL_STORAGE_KEY) ) {
var item = {};
localStorage.setItem(LOCAL_STORAGE_KEY, JSON.stringify(item));
}
};
@honbin
honbin / gist:4405976
Created December 29, 2012 10:33
how to upload gem
gem build hoge.gemspec
rake install
gem push pkg/hoge-0.0.1.gem
Dir.glob("controllers/*.rb").each { |r| require_relative r }
<?php
trait Accessors
{
public function __get($property)
{
if(property_exists($this, $property)) {
return $this->$property;
}
}
<?php
class Test
{
private $hoge = "hoge";
public function __get($property)
{
if(property_exists($this, $property)) {
return $this->$property;
}

#whats ElasticSearch Luceneベースの全文検索システム

#feature

  • HTTP API(REST)

##for example ###PUT

curl -XPUT http://localhost:9200/twitter/tweet/1 -d '{