Skip to content

Instantly share code, notes, and snippets.

🦄
Doing FINE !

Rungsikorn Rungsikavanich zapkub

🦄
Doing FINE !
Block or report user

Report or block zapkub

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@zapkub
zapkub / assessment.ts
Created May 20, 2019
Assessment API abstraction
View assessment.ts
import { CommonEntityAttrs } from './default'
// Reference to ./docs/assessment-specs.md
export interface PlantFieldAssessment extends CommonEntityAttrs {
kind: 'PlantFieldAssessment'
plantSeasonId: number
seasonId: number
@zapkub
zapkub / isEmpty.ts
Last active May 19, 2019
Empty checking with type guard
View isEmpty.ts
import { isNull } from 'util'
type Empty = null | undefined | 0 | false | ''
export function IsEmpty<T>(thing: T | undefined | null | 0 | false | ''): thing is Empty {
const undefinedOrNull = typeof thing === 'undefined' || thing === null
if (undefinedOrNull) {
return true
}
View distance.sql
declare @p geography = geography::Point(10.5, 10.5, 4326);
SELECT *
FROM (
select Plant_ID,Plant_GeoLocation.STIsValid() as IsSTValid, Plant_GeoLocation.MakeValid().RingN(1).STDistance(@p) as Distance, Plant_GeoLocation as Geolocation from dbo.tb_opr_Plant
WHERE Plant_GeoLocation IS NOT NULL AND Plant_GeoLocation.STIsValid() = 1
) DistanceMeastureFromPoint
WHERE Distance < 1000
View user.ts
interface UserAccount {
id: string
createdAt: Date
name: string
mobileNumber: string
password: string
}
type CreateNewUserAccountInput = Pick<UserAccount, Exclude<keyof UserAccount, 'id' | 'createdAt'>>
export type CreateNewUserAccount = (input: CreateNewUserAccountInput) => UserAccount
View user.ts
interface UserAccount {
id: string
createdAt: Date
name: string
mobileNumber: string
password: string
}
View user.ts
interface CreateUserAccountInput{
name: string
mobileNumber: string
password: string
}
interface CreateUserAccountOutput extends CreateUserAccountInput{
id: string
createdAt: Date
}
@zapkub
zapkub / aws-ecr-credential.go
Last active Mar 5, 2019
how to get AWS credential from ECR with golang
View aws-ecr-credential.go
/*
* Copyright (c) 2019. Inception Asia
* Maintain by DigithunWorldwide ❤
* Maintainer
* - rungsikorn.r@digithunworldwide.com
* - nipon.chi@digithunworldwide.com
*/
package util
View gist:d867adcac217ddde761ff7442262a35d
import * as React from 'react'
import Head from "next/head";
export default () => {
return (
<div>
<Head>
<link rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"
View gg.go
package main
import (
"bufio"
"encoding/json"
"fmt"
"github.com/stellar/go/build"
"github.com/stellar/go/clients/horizon"
"github.com/stellar/go/keypair"
"net/http"
View gist:afada6dfe924e081457af90c2c935528
package main
import (
"fmt"
"github.com/stellar/go/build"
"github.com/stellar/go/clients/horizon"
"github.com/stellar/go/keypair"
"net/http"
)
You can’t perform that action at this time.