Skip to content

Instantly share code, notes, and snippets.

@vexus2
vexus2 / joke.coffee
Created June 4, 2014 02:11
"ぬるぽ"に反応してガッしてくれるHubotスクリプト Slack内での表示に最適化済
# Description:
# Joke commands.
#
# Commands:
# ぬるぽ - You reply with, "ガッ" When you post a "ぬるぽ" word.
#
# Notes:
# ネタ/ジョーク系のbot全般
module.exports = (robot) ->
@vexus2
vexus2 / common_validator.php
Created October 11, 2012 01:30
[PHP]汎用バリデーションクラス
<?php
/**
* 汎用バリデータ用クラス
* 文字列・数字・文字数などのチェックを行う
*/
class CommonValidator
{
/**
* 日付のフォーマット配列
*/
@vexus2
vexus2 / nico_video_fetcher.rb
Created October 8, 2012 14:04
[Ruby]ニコニコ動画APIを叩くとき用。事前にログインさせCookie値を取得する。
# ログインしてクッキー抽出
def login(mail, pass)
host = 'secure.nicovideo.jp'
path = '/secure/login?site=niconico'
body = "mail=#{mail}&password=#{pass}"
https = Net::HTTP.new(host, 443)
https.use_ssl = true
https.verify_mode = OpenSSL::SSL::VERIFY_NONE
response = https.start { |https|
@vexus2
vexus2 / import_and_export_firebase_auth.txt
Created February 18, 2019 07:01
2019-02-18_Firestoreリージョン移行に伴うFirebaseプロジェクト移行手順
$ firebase auth:export firebase-auth-users.json --format json --project 旧Firebaseプロジェクト
$ firebase auth:import firebase-auth-users.json --project 新Firebaseプロジェクト
Jenkins × PHP環境構築の巻
■目的
PHP環境に対応したJenkins設定を行い、
コミットされる度にサーバ上でのPHPUnitの実行 及び
カバレッジレポート出力を"全自動"で行えるようにすること。
1) PHP Pear系のインストール
sudo pear channel-discover pear.phing.info
sudo pear channel-discover pear.pdepend.org
@vexus2
vexus2 / contributor.java
Created November 21, 2013 04:32
completion contributor
@Override
public void fillCompletionVariants(CompletionParameters parameters, CompletionResultSet result) {
String arr$[] = new String[] {"foo", "bar"};
int len$ = arr$.length;
for (int i$ = 0; i$ < len$; i$++) {
String s = arr$[i$];
result.addElement(createDocTagLookup(false, s));
}
@vexus2
vexus2 / gist:5931909
Created July 5, 2013 05:05
Show Dialog and catch handlers
public void syncWithSonar(Project project) {
Collection<Rule> sonarRules = this.sonarRulesByRuleKey.values();
int oldSize = sonarRules.size();
clearState();
Collection<SonarSettingsBean> allSonarSettingsBeans = SonarSettingsComponent.getSonarSettingsBeans(project);
SonarService sonarService = ServiceManager.getService(SonarService.class);
if (null != allSonarSettingsBeans) {
for (Rule rule : sonarService.getAllRules(allSonarSettingsBeans)) {
this.sonarRulesByRuleKey.put(rule.getKey(), rule);
@vexus2
vexus2 / dialog.java
Last active December 18, 2015 15:09
open PhpNewFileDialog.
protected dialog(AnActionEvent e) throws Exception {
Project project = e.getProject();
DataContext dataContext = e.getDataContext();
IdeView view = LangDataKeys.IDE_VIEW.getData(dataContext);
if (view == null) {
return;
}
Project project = PlatformDataKeys.PROJECT.getData(dataContext);
### Sample Settings
# aliases
# in this example you can open extensions page by the command ':ext'
# and Chrome's option page by the command ':option'
alias ext TabOpenNew chrome://extensions/
alias option TabOpenNew chrome://settings/browser
alias downloads TabOpenNew chrome://downloads
alias history TabOpenNew chrome://history
@vexus2
vexus2 / graph.html
Last active December 10, 2015 02:58
[JS]GoogleChartAPIにて棒グラフ出力用テンプレート。 別途json出力用APIは必要。
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script type="text/javascript"
src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load('visualization', '1', {packages:['corechart']});
</script>
<script type="text/javascript">
(function () {
drawGraph = function () {
$.ajax({