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 / 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);
service: horike-service
provider: aws
functions:
hello:
handler: handler.hello
events:
- http:
path: hello
method: GET
resources:
@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 / amimoto-single-instance.json
Last active January 6, 2016 22:30
VPCのネットワーク設定からシングルインスタンスのAMIMOTO立ち上げるCloudFormation テンプレート
{
"Parameters":{
"InstanceType": {
"Description": "EC2 instance type",
"Type": "String",
"Default": "t2.small",
"AllowedValues": [
"t2.small",
"t2.medium",
"t2.large",
@horike37
horike37 / query.php
Last active December 10, 2015 15:27
WordPress上の記事をElasticaをつかってElasticSearchにインポート
<?php
require_once 'vendor/autoload.php';
use Elastica\Client;
use Elastica\Query;
use Elastica\Query\QueryString;
add_action( 'pre_get_posts', function($query){
if ( $query->is_search() && $query->is_main_query() ) {
$client = new \Elastica\Client(array(