Skip to content

Instantly share code, notes, and snippets.

View JWally's full-sized avatar

Justin Wolcott JWally

  • Dallas, Texas, United States
View GitHub Profile
@JWally
JWally / server.mjs
Last active January 28, 2024 23:44
// Set default response headers as `const`
let DEFAULT_HEADERS = {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Credentials": true,
};
export const handler = async (event) => {
// N.B. YOU SHOULD MAKE A _REAL_ APPLICATION WITH ERROR CHECKING
// AND SOLID DEV PRACTICES. THIS IS A PROOF-OF-CONCEPT.
@JWally
JWally / index.html
Last active January 27, 2024 12:30
<!DOCTYPE html>
<html>
<head><meta charSet="utf-8"/></head>
<body><h1>GOODBYE FRAUD!</h1></body>
<!-- Adding library from NPM via UNPKG -->
<script type="module" >
// Pull Library from CDN
import {XRAY} from 'https://unpkg.com/@keyri/xray/index.mjs';

Object Overview

  • Purpose: This object encapsulates comprehensive data about the user, their device, and IP address. It is instrumental in constructing rules and making informed decisions.

Key Components Description

The decrypted return object comprises an instance object, which includes detailed information about the event, user's device, IP address, and user.

  • eventType: Identifies the type of event being evaluated.
  • eventMetadata: An optional field for logging additional event details.
  • userId: The provided ID of the user.
  • timeData: Breakdown of the current time (year, month, hour, etc.) useful in setting rules based on usual operating hours.

The Rules Engine

Introducing "The Rules Engine" – the pinnacle of precision and flexibility in digital security and user experience management.

Designed to empower businesses with the ability to construct meticulously detailed rules, this engine stands as a bulwark against fraud and account takeover attempts. With its advanced logic capabilities, "The Rules Engine" enables you to define conditions with surgical precision, ensuring that each user interaction is scrutinized for potential threats, while simultaneously maintaining a seamless and frictionless experience for your seasoned users.

It's not just a tool; it's your frontline defense and smart facilitator, adeptly balancing security and user convenience. Whether it's safeguarding sensitive information or streamlining user access, "The Rules Engine" adapts to the complex and evolving landscape of digital interactions, making it an indispensable ally in the modern digital era.

Logic Operators

//
// NOVEL Function to return the {{k}} most frequent items
// in a javascript array (of strings or numbers) by SIMULTANEOUSLY
// tracking count in a "lookup" object ** AND ** a sortable "output"
// array
//
// Arguments:
// - items: an array of strings or numbers [1,3,500,2,1,3]
// - k: the number of results you want returned
//
var http = require("http"),
https = require("https"),
fs = require("fs"),
path = require("path"),
serveStatic = require("serve-static");
// Serve up public/ftp folder
var serve = serveStatic(path_to = path.join(__dirname, ".."));
var options = {
@JWally
JWally / gist:b511fdd16e57fa442ba3
Last active August 29, 2015 14:07
Geometry Stuff
// Quick and dirty function for calculating the interior angle
// of each bend of a polygon
var polySide = function(sides){
return ((sides - 2) * 180) / sides;
}
// Another geometry bender
// expects starting coordinates
// to dome in a d3 friendly {x: x, y: y} array
@JWally
JWally / RelationshipTree.js
Last active September 8, 2022 12:13
Javascript Algorithm to build an org chart from an array of related objects
var ary = [
{id: "a", parent: 0},
{id: "b", parent: "a"},
{id: "c", parent: "b"},
{id: "d", parent: "c"},
{id: "e", parent: "d"},
{id: "f", parent: "e"},
{id: "g", parent: "f"},
{id: "h", parent: "g"},
{id: "i", parent: "h"},
@JWally
JWally / dumbTimer.js
Last active December 20, 2015 13:18
Ugly Timer object
function simpleTimer(){
var that = this;
this.obj = {
open_time: 0
,close_time: 0
,total_time: 0
};
this.intTimer = {};