Skip to content

Instantly share code, notes, and snippets.

Avatar

Hemika Kodikara hemikak

View GitHub Profile
@hemikak
hemikak / template.yml
Created Feb 21, 2020
"Hello World" AWS SAM Specification
View template.yml
AWSTemplateFormatVersion: "2010-09-09"
Transform: AWS::Serverless-2016-10-31
Description: AWS Lambda Hello World Ballerina
Globals:
Function:
Timeout: 10
Resources:
HelloWorldFunction:
Type: AWS::Serverless::Function
Properties:
@hemikak
hemikak / hello_world.bal
Created Feb 21, 2020
"Hello World" AWS Lambda Function in Ballerina
View hello_world.bal
import ballerinax/awslambda;
@awslambda:Function
public function sayHello(awslambda:Context ctx, json input) returns json|error {
return "Hello World!";
}
View wind.bat
@echo off
REM ---------------------------------------------------------------------------
REM Copyright (c) 2020, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
REM
REM Licensed under the Apache License, Version 2.0 (the "License");
REM you may not use this file except in compliance with the License.
REM You may obtain a copy of the License at
REM
REM http://www.apache.org/licenses/LICENSE-2.0
@hemikak
hemikak / Dockerfile
Last active Apr 11, 2019
Ballerina Docker Image for Windows
View Dockerfile
FROM openjdk:8u201-jdk-nanoserver-sac2016
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
LABEL maintainer="dev@ballerina.io"
ARG BALLERINA_DIST
RUN New-Item -path C:\ -name "ballerina" -type directory | Out-Null;
RUN New-Item -path C:\ -name "tmp" -type directory | Out-Null;
@hemikak
hemikak / web_server.bal
Last active Feb 24, 2020
A simple web server written in Ballerina
View web_server.bal
// Copyright (c) 2018, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
//
// WSO2 Inc. licenses this file to you under the Apache License,
// Version 2.0 (the "License"); you may not use this file except
// in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
@hemikak
hemikak / got_quote_service.bal
Last active Mar 29, 2019
Ballerina service to get quotes from Game of Thrones(with annotations and trimmed)
View got_quote_service.bal
import ballerina/http;
import ballerina/log;
import ballerinax/kubernetes;
import ballerinax/openshift;
@openshift:Route {
host: "www.got-quote.com"
}
@kubernetes:Service {}
listener http:Listener gotServiceEP = new(9090); // ballerina service endpoint
@hemikak
hemikak / got_quote_service.bal
Last active Mar 21, 2019
Ballerina service to get quotes from Game of Thrones
View got_quote_service.bal
import ballerina/http;
import ballerina/log;
listener http:Listener gotServiceEP = new(9090); // ballerina service endpoint
http:Client gotQuoteAPI = new("https://got-quotes.herokuapp.com/quotes"); // game of thrones API endpoint
@http:ServiceConfig {
basePath: "/got" // basepath for my service
}
service gotService on gotServiceEP {
View ballerina-central.yml
swagger: '2.0'
info:
version: 1.0.0
title: PackagingService
basePath: /p
paths:
'/{orgName}/{packageName}/{packageVersion}':
get:
operationId: handlePullRequest
parameters:
View php-deep-equal-test.php
<?php
echo "Arrays" . "\xA";
// Arrays
$cars = array("Volvo","BMW","Toyota");
$cars2 = array("Volvo","BMW","Toyota");
$cars3 = array("Nissan","e","8");
var_dump($cars === $cars);
var_dump($cars === $cars2);
var_dump($cars === $cars3);