Skip to content

Instantly share code, notes, and snippets.

View subeshb1's full-sized avatar
👹
Learning and Innovating

Subesh subeshb1

👹
Learning and Innovating
View GitHub Profile
<?php
$DASHBOARD_ID = "<DASHBOARD_ID>";
// Check if MemberPress class is accessible
if(class_exists('MeprUtils')) {
$user = MeprUtils::get_currentuserinfo();
// Check if the current user information is found
if($user != null) {
// Setting default region the where the dashboard is located.
putenv('AWS_DEFAULT_REGION=' . 'us-east-1');
@subeshb1
subeshb1 / external.js
Created June 10, 2020 15:29
External script api-test
let testCase = process.argv[2]; // First arg will be test case key
let body = process.argv[3]; // Second arg will be body
let header = process.argv[4]; // Third arg will be header
let success = true;
switch (testCase) {
case "get_api":
if (success) {
process.exit(0); // For success case
} else {
@subeshb1
subeshb1 / test.json
Created June 10, 2020 14:16
api-test with tests
{
"testCases": {
"get_api": {
"path": "/books",
"query": {
"id": "1"
},
"expect": {
"body": {
"contains": {
@subeshb1
subeshb1 / test.json
Created June 10, 2020 08:04
api-test tutorial
{
"testCases": {
"get_api": {
"path": "/books",
"query": {
"id": "1"
}
},
"post_api": {
"path": "/books",
// CH002 :: Pythagorean Triplet
package main
import "fmt"
func pythagoreanTriplet(number int) (int, int, int) {
for first := 1; first <= number/2; first++ {
for second := first + 1; second <= number/2; second++ {
third := number - (first + second)
if (first*first)+(second*second) == (third * third) {
package main
// CH006 :: Weird Number
import (
"fmt"
)
func max(a, b int) int {
if a > b {
package main
// CH005 :: Curious Number
import (
"fmt"
"math"
)
func isCuriousNumber(number int) bool {
package main
// CH004 :: Happy Number
import (
"fmt"
"math"
)
func squaredDigitSum(number int) int {
package main
// CH007 :: LCM of numbers
import "fmt"
func hcf(a, b int) int {
if a == 0 {
return b
}