Skip to content

Instantly share code, notes, and snippets.

@i2key
i2key / heroku_nodejs_mecab.md
Created January 2, 2018 15:29
heroku に node.js & mecab環境構築
$ heroku buildpacks:add --index 3 https://github.com/knjcode/heroku-buildpack-mecab-ipadic-neologd.git
 ▸    The buildpack https://github.com/knjcode/heroku-buildpack-mecab-ipadic-neologd.git is already set on your app.
$ heroku buildpacks:add --index 1 heroku/nodejs
Buildpack added. Next release on rapbattle-mecab will use:
  1. heroku/nodejs
 2. https://github.com/knjcode/heroku-buildpack-mecab-ipadic-neologd.git
@i2key
i2key / invalidateCloudfrontCache.js
Last active February 3, 2016 15:02
cloudfrontでwebホスティングしてるときにJS等の特定のファイルのS3へのputObjectをトリガーにそのファイルのキャッシュを消去するAWS Lambda
var aws = require('aws-sdk');
var cloudfront = new aws.CloudFront();
exports.handler = function(event, context) {
var bucket = event.Records[0].s3.bucket.name;
var key = decodeURIComponent(event.Records[0].s3.object.key.replace(/\+/g, ' '));
var params = {
DistributionId: 'CloudFrontのDistibutionId',
InvalidationBatch: {
CallerReference: 'LAMBDA' + new Date().getTime(),
@i2key
i2key / RetirementOfEngineer.md
Last active February 3, 2016 14:47
I translated http://qiita.com/shinichinomura/items/da9d53f8e3f31df96e7a with broken English to discuss with non Japanese engineers

#the theory of Retirement age of engineer is 35 years old (Japanese engineers pessimistically talk about this ) ##1st phase

  • before service is rolled out
  • you develop the code of service by yourself
  • the thing that you must do is only developing your service
  • though you are working 16hours per day, you are not tired because you only are programing. it's fun.
  • you spend all time to develop your service
  • you enjoy almighty feeling because you impelement all thing from infrastructure layer to software layer a.k.a full-stack engineer

##2nd phase

@i2key
i2key / react_tutorial.html
Created December 1, 2015 08:32
React.js official tutorial
<!-- index.html -->
<html>
<head>
<title>Hello React</title>
<script src="https://fb.me/react-0.13.3.js"></script>
<script src="https://fb.me/JSXTransformer-0.13.3.js"></script>
<script src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
</head>
<body>
<div id="content"></div>
package app.model
sealed abstract class TicketStatus { }
case object Open extends TicketStatus
case object Fixed extends TicketStatus
@i2key
i2key / ShareImageToLine
Created November 20, 2013 13:39
LINEに画像シェアの変更点
+ (BOOL)shareImageBeforeIOS7:(UIImage *)image {
UIPasteboard *pasteboard = [UIPasteboard pasteboardWithName:@"jp.naver.line.pasteboard" create:YES];
[pasteboard setData:UIImageJPEGRepresentation(image, 0.8) forPasteboardType:@"public.jpeg"];
return [[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"line://msg/image/%@", pasteboard.name]]];
}
+ (BOOL)shareImageAfterIOS7:(UIImage *)image {
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
[pasteboard setData:UIImageJPEGRepresentation(image, 0.8) forPasteboardType:@"public.jpeg"];
return [[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"line://msg/image/%@", pasteboard.name]]];