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 / ExampleFileMD5.js
Last active July 17, 2023 20:23
Simple Method to Calculate the Hash of a file in Javascript using HTML5 API
//Event Listener tied to the file input field
document.getElementById('attachment').addEventListener('change', eventHandler, false)
/**
*Description: Simple method to handle an event
*and fire off a function
**/
function eventHandler(evt){
var file = evt.target.files[0];
fileHash( file, md5, function(x){
define(function(){
var instance = null;
function MySingleton(){
if(instance !== null){
throw new Error("Cannot instantiate more than one MySingleton, use MySingleton.getInstance()");
}
this.initialize();
}
@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 = {};
@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 / 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
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 = {
//
// 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
//

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

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.