Skip to content

Instantly share code, notes, and snippets.

James M. Greene JamesMGreene

Block or report user

Report or block JamesMGreene

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@JamesMGreene
JamesMGreene / genRandomStrings.js
Created Dec 12, 2017
Generic random alphabetical strings with JavaScript
View genRandomStrings.js
var validChars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');
var validCharsUpperBound = validChars.length - 1;
function randomInt(lower, upper) {
return lower + Math.floor(Math.random() * (upper - lower + 1))
}
function randomLetter() {
return validChars[randomInt(0, validCharsUpperBound)];
}
@JamesMGreene
JamesMGreene / gist:ec88338f047db436a1865aae23af83fd
Created Nov 17, 2017 — forked from kitek/gist:1579117
NodeJS create md5 hash from string
View gist:ec88338f047db436a1865aae23af83fd
var data = "do shash'owania";
var crypto = require('crypto');
crypto.createHash('md5').update(data).digest("hex");
View app.js
This file has been truncated, but you can view the full file.
(function(FuseBox){FuseBox.$fuse$=FuseBox;
FuseBox.pkg("default", {}, function(___scope___){
___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
var zmq = require('zmq')
var pub = zmq.socket('pub')
pub.bindSync('tcp://127.0.0.1:3000')
console.log('Publisher bound to port 3000')
@JamesMGreene
JamesMGreene / README.md
Last active Feb 6, 2018
Trying out nexe@2.x beta native module bundling
View README.md

Environment

  • Windows 10 (x64)
  • VS2015
  • Python 2.7.11
  • node@6.11.0
  • nexe@2.0.0-beta.2
  • fuse-box@2.2.1
View teachers-needed.md

Looking for workshop teachers to teach on the following topics!

For introductions please tweet @frontendmasters, @1marc or email: marc at FrontendMasters.com. Thanks!

You can propose other topics too.

Published blog post detailing topics and allowed people to vote on priority: 2016 Frontend Masters topic poll

Bolded topics are very highly requested.

@JamesMGreene
JamesMGreene / isXhtmlDoc.js
Last active May 10, 2016
Simple function to determine if a given Document object in JavaScript represents an XHTML document.
View isXhtmlDoc.js
//
// References important to this particular implementation:
// - http://ejohn.org/blog/nodename-case-sensitivity/
// - http://help.dottoro.com/ljdgsrle.php
// - http://www.w3schools.com/html/html_xhtml.asp
// - http://www.w3schools.com/tags/tag_doctype.asp
//
// Other related references if additional parameters are ever needed:
// - http://reference.sitepoint.com/javascript/Document/doctype
// - http://reference.sitepoint.com/javascript/DocumentType
@JamesMGreene
JamesMGreene / WebDriverUrls.md
Last active Apr 14, 2016
WebDriver Download URLs and info for all desktop WebDriver instances
View WebDriverUrls.md

General Selenium download info available on [SeleniumHQ][]

Edge

Must run the installer:

  • v1.0 a.k.a. "Microsoft WebDriver"
  • v2.0 a.k.a. "Microsoft WebDriver Fall 2015 Update"
@JamesMGreene
JamesMGreene / EventedDatastore.js
Last active Jul 9, 2019
Forcibly adding NeDB events by deriving from the Datastore prototype
View EventedDatastore.js
// IMPORTANT:
// As of nedb@^1.7.0, Datastore now inherits from EventEmitter in the NeDB core module.
// If you need to support older versions of NeDB, please look at the following previous revision
// of this gist:
// https://gist.github.com/JamesMGreene/0e0b2506c7bd2a2557f7/d8b4b1e97bb0d118c509672e3c7276b6dc4ba13a
/*
This gist provides a module which derives from the NeDB Datastore module and extends it to
emit several important events:
@JamesMGreene
JamesMGreene / .editorconfig
Created Nov 16, 2015
Example EditorConfig file
View .editorconfig
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org
root = true
[*]
end_of_line = lf
charset = utf-8
View install-nodejs.sh
#!/bin/sh
#version details
VERSION=0.8.8
PLATFORM=linux
ARCH=x86
PREFIX="$HOME/node-v$VERSION-$PLATFORM-$ARCH"
#download binaries
mkdir -p "$PREFIX" && \
You can’t perform that action at this time.