Skip to content

Instantly share code, notes, and snippets.

View bennadel's full-sized avatar
💭
Life's a garden, dig it!

Ben Nadel bennadel

💭
Life's a garden, dig it!
View GitHub Profile
@bennadel
bennadel / code-1.htm
Created March 25, 2014 12:13
Creating A Fixed-Length Queue In JavaScript Using Arrays
<!DOCTYPE html>
<html>
<head>
<title>Fixed-Length Queue Data Type In JavaScript</title>
<script type="text/javascript">
// Create a constructor for the fixed-length queue. This is
// really more of a FACTORY than a construtor since an
@bennadel
bennadel / cast.js
Created November 21, 2016 12:25
Casting Bit Fields To Booleans Using The Node.js MySQL Driver
// Import the core node modules.
var mysql = require( "mysql" );
// Create the connection to your database. This time, we're going to use our own custom
// type casting function to manually coerce some of the columns.
var db = mysql.createConnection({
host: "localhost",
user: "root",
password: "",
database: "testing",
@bennadel
bennadel / app.component.ts
Created January 23, 2019 13:24
Providing Module Configuration Using forRoot() And Ahead-Of-Time Compiling In Angular 7.2.0
// Import the core angular services.
import { Component } from "@angular/core";
// Import the application components and services.
import { MyService } from "./my-service/my-service.module";
// ----------------------------------------------------------------------------------- //
// ----------------------------------------------------------------------------------- //
@Component({
@bennadel
bennadel / angularjs-form-post.htm
Created April 23, 2014 11:43
Posting Form Data With $http In AngularJS
<!doctype html>
<html ng-app="Demo">
<head>
<meta charset="utf-8" />
<title>
Posting Form Data With $http In AngularJS
</title>
</head>
<body ng-controller="DemoController">
@bennadel
bennadel / encrypt.cfm
Created July 9, 2016 12:48
Using AES / ECB / PKCS5Padding Encryption In ColdFusion And Decrypting Values In Node.js
<cfscript>
// I am the value that we will be encrypted and decrypting.
input = "Get out back and hold the monkey!";
// Generated using generateSecretKey( "AES", 128 ).
encryptionKey = "JZidBZLaYf27huVuM4MNTA==";
// Put the input through the encryption and decryption life-cycle using the AES
// algorithm and the default [AES], [IVorSalt], and [iterations] values.
@bennadel
bennadel / code-1.cfm
Created March 25, 2014 00:10
Generating Random Passwords In ColdFusion Based On Sets Of Valid Characters
<!---
We have to start out be defining what the sets of valid
character data are. While this might not look elegant,
notice that it gives a LOT of power over what the sets
are without writing a whole lot of code or "condition"
statements.
--->
<!--- Set up available lower case values. --->
<cfset strLowerCaseAlpha = "abcdefghijklmnopqrstuvwxyz" />
@bennadel
bennadel / encrypt.cfm
Created July 14, 2016 10:38
Using AES / CBC / PKCS5Padding / IV Encryption In ColdFusion And Decrypting Values In Node.js
<cfscript>
// Generated using generateSecretKey( "AES", 128 ).
encryptionKey = "Glu0r6o0GzBZIe0Qsrh2FA==";
// Generated using randRange() with "SHA1PRNG" algorithm.
initializationVector = "53IQ1tPX3aHxzqV4AyePDg==";
// I am the value that we will be encrypted and decrypting.
input = "Get out back and hold the monkey!";
@bennadel
bennadel / angularjs-modals.htm
Created March 23, 2015 12:19
Creating A Simple Modal System In AngularJS
<!doctype html>
<html ng-app="Demo">
<head>
<meta charset="utf-8" />
<title>
Creating A Simple Modal System In AngularJS
</title>
<link rel="stylesheet" type="text/css" href="./demo.css"></link>
@bennadel
bennadel / bug1.cfm
Created February 24, 2012 14:01
ColdFusion 10 Beta - Miscellaneous Parsing Bugs And Oddities
<cfscript>
// None of the following three return() statements work when used
// in conjunction with implicit-notations for ARRAY, STRUCT, and
// CLOSURE. Must return "( )" from return statement in order to
// parse properly.
function returnImplictNotation(){
return( [ ] );
@bennadel
bennadel / clone-regexp.htm
Created July 24, 2014 12:36
Cloning RegExp (Regular Expression) Objects In JavaScript
<!doctype html>
<html>
<head>
<title>Cloning RegExp (Regular Expression) Objects In JavaScript</title>
</head>
<body>
<script type="text/javascript">
/**