Skip to content

Instantly share code, notes, and snippets.

View puthnith's full-sized avatar
🏠
Working from home

Puthnith puthnith

🏠
Working from home
View GitHub Profile
@puthnith
puthnith / example.rego
Last active September 12, 2020 15:28
A proof of concept (POC) of having multiple testable functional rego files for a policy engine using Open Policy Agent (OPA)
package example
import data.fns
date_ranges[{ "node": node }] {
node = fns.get_date_range(input[_].node)
}
const insurance = Machine({
id: 'insurance',
initial: 'inactive',
states: {
inactive: {
on: {
CREATION: 'active',
},
},
active: {
@puthnith
puthnith / ComputeProperty.swift
Created November 14, 2019 21:15
Compute property in Swift
import Foundation
struct StudentType1 {
func setScore(x: Int) {
print(x)
}
func getScore() -> Int {
return 0
@puthnith
puthnith / basic.swift
Created January 10, 2019 20:03
Basic Swift: Variables and Data Types
import UIKit
// Int, Double (Float), Bool, String
// Declaring Constants
let a = 0
let x: Int
x = 10

Keybase proof

I hereby claim:

  • I am puthnith on github.
  • I am puthnith (https://keybase.io/puthnith) on keybase.
  • I have a public key ASCugN17P3JOKs4lTaxu8jUgyNk8-3mktY6n65qv53PVFQo

To claim this, I am signing this object:

@puthnith
puthnith / apollo-koa.ts
Last active July 16, 2020 07:50
The tiny apollo-server-koa
import { graphiqlKoa, graphqlKoa } from 'apollo-server-koa';
import gql from 'graphql-tag';
import { makeExecutableSchema } from 'graphql-tools';
import * as Koa from 'koa';
import * as bodyParser from 'koa-bodyparser';
import * as KoaRouter from 'koa-router';
/*
yarn add \
@puthnith
puthnith / BeginnerFirst.swift
Created March 22, 2018 14:09
Swift for beginner Part 1
import Foundation
// no semi-colon
/* /* */ */
// `var` variable (mutable) and `let` constant (immutable)
// let is the recommand to declar a variable
var x = 0.0 // inferred type / implicitly defined type
x = 10
@puthnith
puthnith / wwdc2017.json
Last active March 22, 2023 06:26
WWDC 2017 Videos in JSON file. Parsed from https://developer.apple.com/videos/wwdc2017/
[
{
"id" : 101,
"title" : "WWDC 2017 Keynote",
"base_url" : "https://p-events-delivery.akamaized.net/17qopibbefvoiuhbsefvbsefvopihb06/vod2/",
"codename" : "",
"hd" : "",
"sd" : "1706iobnouhbljhbsdfv.mp4",
"pdf" : ""
},
@puthnith
puthnith / Node.swift
Last active March 19, 2017 11:59
❤️ to share my 😃 generic reverse singly linked list in Swift 3
//
// Node.swift
//
// Created by Puthnith Var on 18/03/2017.
// Copyright © 2017 Puthnith. All rights reserved.
//
import Foundation
@puthnith
puthnith / FirebaseEmailAccountCode.swift
Created December 11, 2016 01:12
Firebase 🔥 password-based 🔑 accounts code snippets 🗒
import Firebase
// sign up
FIRAuth.auth()?.createUser(withEmail: email, password: password) {
(user, error) in
// user?.email?
}
// sign in
FIRAuth.auth()?.signIn(withEmail: email, password: password) {