Skip to content

Instantly share code, notes, and snippets.

View hemikak's full-sized avatar

Hemika Kodikara hemikak

View GitHub Profile
@hemikak
hemikak / template.yml
Created February 21, 2020 03:56
"Hello World" AWS SAM Specification
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 February 21, 2020 03:10
"Hello World" AWS Lambda Function in Ballerina
import ballerinax/awslambda;
@awslambda:Function
public function sayHello(awslambda:Context ctx, json input) returns json|error {
return "Hello World!";
}
@hemikak
hemikak / wind.bat
Last active January 24, 2020 09:10
@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 April 11, 2019 11:21
Ballerina Docker Image for Windows
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 February 24, 2020 03:19
A simple web server written in Ballerina
// 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 March 29, 2019 10:47
Ballerina service to get quotes from Game of Thrones(with annotations and trimmed)
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 March 21, 2019 08:56
Ballerina service to get quotes from Game of Thrones
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 {
swagger: '2.0'
info:
version: 1.0.0
title: PackagingService
basePath: /p
paths:
'/{orgName}/{packageName}/{packageVersion}':
get:
operationId: handlePullRequest
parameters:
<?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);