Skip to content

Instantly share code, notes, and snippets.

@n-shinya
n-shinya / gist:2074495
Created March 18, 2012 14:47
ATND Search API
require 'pp'
require 'net/http'
require 'json'
require 'sqlite3'
db = SQLite3::Database.new("data.db")
url = {
:scheme => 'http',
:server => 'api.atnd.org',
@n-shinya
n-shinya / gist:2075265
Created March 18, 2012 15:20
create event table
create table event(title varchar(255),url varchar(255));
@n-shinya
n-shinya / gist:2214427
Created March 27, 2012 09:42
How to add custom checks of Findbugs to Sonar

FindbugsのカスタムチェックをSonarに適用する方法

$SONAR_HOME/extensions/rules/findbugsに

  • rules.xml
  • カスタムチェックをまとめたプラグインjar

それぞれ配置して再起動すればよい。
手順はここに書いてある。
http://jira.codehaus.org/browse/SONAR-1481

@n-shinya
n-shinya / gist:2224147
Created March 28, 2012 06:09
[Play1.2.4]認証つきカスタムリポジトリに配置されたjarとPlayモジュールの依存性解決

認証つきMavenリポジトリに配置されたjarとPlayモジュールの依存性解決

こんなシチュエーション。

  • 公開したくないjarとPlayモジュールをBasic認証付きの同一サーバ(Mavenリポジトリ)においている

  • play dependencies を叩いた時にこのサーバからjarとPlayモジュールをダウンロードして依存性を解決したい

手順

@n-shinya
n-shinya / gist:3186790
Last active October 7, 2015 15:28
Sonar Alert Mail
require 'net/http'
require 'net/smtp'
require 'nkf'
require 'rubygems'
require 'json/pure'
require 'pp'
def sendmail(name, key, alert_text)
from = 'xxx@xxx.com'
to = 'yyy@yyy.com'
#!/usr/bin/ruby
dirs = Dir.glob("build_*")
dirs.each do |dir|
config = dir + "/config.xml"
begin
file_r = File.open(config, "r")
buffer = file_r.read
buffer.gsub!("<mavenName>Maven 2.2.1", "<mavenName>2.2.1")

GitをHTTPで公開する

Git - setting up a remote repository (serve via HTTP)

Edit your "httpd.conf"

SetEnv GIT_PROJECT_ROOT /var/www/git
SetEnv GIT_HTTP_EXPORT_ALL
ScriptAlias /git /usr/bin/git-http-backend/
@n-shinya
n-shinya / gist:5260185
Last active December 15, 2015 12:28
Using embedded tomcat (TomcatをJavaから起動する)

Using embedded tomcat (TomcatをJavaから起動する)

WARにパッケージングされたアプリケーションをJavaから起動する方法。

pom.xml

<dependency>
  <groupId>org.apache.tomcat.embed</groupId>
 tomcat-embed-core
@n-shinya
n-shinya / gist:5395146
Created April 16, 2013 11:14
githubプロジェクト内にコミットされている画像をGithub Wikiで表示する

こんな感じで。

![hogehoge](https://github.com/[account]/[project]/blob/master/[filename.png]?raw=true)

@n-shinya
n-shinya / gist:5401419
Last active December 16, 2015 07:49
[Eclipse]JUnit起動時にJVMパラメータを追加する

[Eclipse]JUnit起動時にJVMパラメータを追加する

設定箇所

Run As -> Run Configurations... -> Argumentsタブ -> VM arguments

設定例

-XX:MaxPermSize=256m -Xmx512m