Skip to content

Instantly share code, notes, and snippets.

View nonsocchi's full-sized avatar
😄
Coding for dear life.

nonsocchi nonsocchi

😄
Coding for dear life.
  • RikaiData Ltd
  • Nigeria
View GitHub Profile
@nonsocchi
nonsocchi / gist:c640ce41f44cc345ca0b9d8f560ba2ea
Created August 27, 2021 08:41 — forked from dodyg/gist:5823184
Kotlin Programming Language Cheat Sheet Part 1

#Intro

Kotlin is a new programming language for the JVM. It produces Java bytecode, supports Android and generates JavaScript. The latest version of the language is Kotlin M5.3

Kotlin project website is at kotlin.jetbrains.org.

All the codes here can be copied and run on Kotlin online editor.

Let's get started.

@nonsocchi
nonsocchi / compareTriplets.py
Last active April 12, 2022 11:43
Solution to "Compare the Triplets" on HackerRank.
#!/bin/python3
import math
import os
import random
import re
import sys
#
# Complete the 'compareTriplets' function below.
#!/bin/python3
import math
import os
import random
import re
import sys
#
# Complete the 'divisibleSumPairs' function below.
// SET UP ON SHEETS
function onOpen(e) {
var ui = SpreadsheetApp.getUi();
ui.createMenu('Get Txns').addItem('Populate Sheets', 'processTxnEmails').addToUi();
}
// FILTERING EMAILS...
function getBankEmails() {
// This function searches for messages from “GeNS” and with emails having subject containing
// “GeNS transaction Alert …”
var filter = "subject:GeNS transaction Alert";
var threads = GmailApp.search(filter, 0, 10);
var messages = [];
for (var x in threads) {
<!DOCTYPE html>
<html>
<head>
<base target="_top">
<title>Message Display Test</title>
<link rel="stylesheet" href="https://ssl.gstatic.com/docs/script/css/add-ons1.css">
</head>
<body style="padding:3em;">
<h1>Messages</h1>
<ul>
// FILTERING EMAILS...
function getBankEmails() {
// This function searches for messages from emails having subject containing
// “GeNS transaction Alert …”
var filter = "subject:GeNS transaction Alert";
var threads = GmailApp.search(filter, 0, 10);
var messages = [];
for (var x in threads) {
function doGet() {
return displayEmails();
}
// PARSING EMAIL MESSAGES...
function parseMessageBody(messages) {
var txnData = [];
for (var m = 0; m < messages.length; m++) {
var text = messages[m].getPlainBody();
Logger.log(m);
<!DOCTYPE html>
<html>
<head>
<base target="_top">
<title>Data parsed from emails</title>
<link rel="stylesheet" href="https://ssl.gstatic.com/docs/script/css/add-ons1.css">
</head>
<body style="padding:3em;">
<h2>Parsed data from Messages</h2>
<table style="width:800px">