Skip to content

Instantly share code, notes, and snippets.

View horike37's full-sized avatar

Takahiro Horike horike37

  • Serverless Operations, Inc
  • Japan
View GitHub Profile
@horike37
horike37 / test.js
Last active November 12, 2020 16:31
The sample code of unit test Lambda function in Serverless Framework projects .
const path = require('path'),
chai = require('chai'),
should = chai.should(),
Serverless = require('serverless')
describe('ServerlessProjectTest', function() {
beforeEach(function(done) {
this.timeout(0);
s = new Serverless();
@horike37
horike37 / cors.html
Created February 4, 2019 05:51
Ajax for Cors test
<!doctype html>
<html lang="ja">
<head>
<script src="https://code.jquery.com/jquery-3.3.1.js"></script>
<meta charset="UTF-8">
</head>
<body>
<script type="text/javascript">
$(document).ready(function(){
$.ajax({

Serverless Frameworkコントリビューションガイド

コントリビューションの種類

  • フォーラムでの回答
  • issueを立ててバグ報告
  • slackの場でトラブルシューティング
  • ドキュメントの翻訳
  • GitHub上でスターを付ける
  • プラグインを開発して公開
  • Tipsなどをブログにまとめて公開
  • examplesリポジトリへのユースケース追加
@horike37
horike37 / Workshop.md
Last active November 2, 2017 05:37 — forked from shundy/Workshop.md
Serverless Workshop

Event Gateway

Node のインストール

brew install nodebrew
echo 'export PATH=$PATH:$HOME/.nodebrew/ current/bin' >> ~/.bash_profile
mkdir -p ~/.nodebrew/src
nodebrew install-binary v6.11.5
@horike37
horike37 / sls-workshop.md
Last active June 10, 2017 04:01
Serverlessワークショップコピペ用

インストール

npm install -g serverless serverless -v

credential設定

serverless config credentials --provider aws --key --secret --profile sls-workshop

サービスの作成

{
"APIAssumeRolePolicyDocument": {
"Type": "AWS::IAM::Role",
"Properties": {
"AssumeRolePolicyDocument": {
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
'use strict';
const AWS = require('aws-sdk');
const BbPromise = require('bluebird');
class AwsProvider {
request(service, method, params) {
const awsService = new AWS[service]();
const req = awsService[method](params);
@horike37
horike37 / gist:7410391
Last active July 25, 2016 12:46
Trust Formの管理者宛メールの件名をカスタマイズする
<?php
add_filter( 'tr_subject_admin_mail', 'my_tr_subject_admin_mail', 10, 3 );
function my_tr_subject_admin_mail( $subject, $data, $id ) {
$responce = get_post_meta( $id, 'answer' );
krsort($responce);
$entry_id = key($responce);
return $subject . '[id:'.$entry_id.']';
}
service: horike-service
provider: aws
functions:
hello:
handler: handler.hello
events:
- http:
path: hello
method: GET
resources:
@horike37
horike37 / file0.js
Last active June 16, 2016 19:18
Amazon API Gateway + Lambda + CloudSearchで検索APIサービスを作ってみる ref: http://qiita.com/horike37/items/3e37ff6416f6cf2a7934
var aws = require('aws-sdk');
var cloudsearchdomain = new aws.CloudSearchDomain({
endpoint: '<CloudSearchのエンドポイント>'
});
exports.handler = function(event, context) {
var params = {
query:event.q
};