Skip to content

Instantly share code, notes, and snippets.

@frah
frah / DocumentParser.patch
Last active Dec 31, 2015
KBPublisher用語集日本語キーワード対応パッチ
View DocumentParser.patch
--- old/DocumentParser.php Wed Dec 18 14:16:57 2013
+++ new/DocumentParser.php Wed Dec 18 14:18:43 2013
@@ -143,7 +143,7 @@
$ids = array();
foreach($glossary as $id => $item) {
- if(strpos(strtolower($string), strtolower($item)) !== false) {
+ if(mb_strpos(mb_strtolower($string), mb_strtolower($item)) !== false) {
$ids[] = $id;
}
@frah
frah / index.js
Last active Apr 17, 2016
Put datas received at Kinesis into DynamoDB
View index.js
'use strict';
var doc = require('dynamodb-doc');
var dynamodb = new doc.DynamoDB();
console.log('Loading function');
exports.handler = (event, context, callback) => {
event.Records.forEach((record) => {
// Kinesis data is base64 encoded so decode here
const payload = new Buffer(record.kinesis.data, 'base64').toString('ascii');
const json = JSON.parse(payload);
@frah
frah / sens-graph.js
Created Apr 17, 2016
グラフ描画(主要部のみ)
View sens-graph.js
function onMessageArrived(message) {
var j = JSON.parse(message.payloadString);
var data = undefined;
var datas = j.datas;
for (var i=0;i<datas.length;i++) {
switch (datas[i].name) {
case "watt":
data = datas[i];
break;
case "temperature":
View index.js
'use strict';
console.log('Loading function');
let doc = require('dynamodb-doc');
let dynamo = new doc.DynamoDB();
function date_desc(a, b) {
let aa = new Date(a.date);
let bb = new Date(b.date);
if (aa < bb) return -1;
@frah
frah / gist:5a91b2feb5a511608eecc30d9ac79297
Last active Jan 20, 2017 — forked from onozaty/gist:a684d5e8087f03bc20c6
Better checkbox field by Redmine view customize plugin(トラッカー変更対応版)
View gist:5a91b2feb5a511608eecc30d9ac79297
// Path pattern: /issues/
// Type : JavaScript
$(function() {
var ec_observer = new MutationObserver(function() {enhance_checkbox()});
var ec_target = document.getElementById('all_attributes');
ec_observer.observe(ec_target, { attributes: false, childList: true, characterData: false });
function enhance_checkbox() {
$('.check_box_group')
.each(function() {
View .vimrc
set nocompatible
filetype off
"-----------------------------
" Vundle
"-----------------------------
if has('vim_starting')
set nocompatible
set runtimepath+=~/.vim/bundle/neobundle.vim/
endif