Skip to content

Instantly share code, notes, and snippets.

View JamesMGreene's full-sized avatar

James M. Greene JamesMGreene

View GitHub Profile
#!/bin/sh
#version details
VERSION=0.8.8
PLATFORM=linux
ARCH=x86
PREFIX="$HOME/node-v$VERSION-$PLATFORM-$ARCH"
#download binaries
mkdir -p "$PREFIX" && \
@JamesMGreene
JamesMGreene / example_def.rb
Last active September 15, 2018 09:00
Ruby class methods vs. instance methods
class Human
# Class method (a.k.a. static method)
def self.classification
'Mammal'
end
# Instance constructor
def initialize(first_name, last_name)
<!doctype html>
<html>
<head>
<title>currentScript Example</title>
<script type="text/javascript" id="mainscript" async>
if (document.currentScript && document.currentScript.async) {
console.log("Executing asynchronously");
} else {
@JamesMGreene
JamesMGreene / index.html
Last active August 29, 2015 14:14
Basic `script.readyState`/`document.readyState` tests
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Basic `script.readyState`/`document.readyState` tests</title>
<script id="loadFirst">
window.console && console && console.log && console.log("loadFirst script, evaluating first line");
function _write(msg) {
var bod = document.body || document.getElementsByTagName("body")[0];
@JamesMGreene
JamesMGreene / index.html
Last active August 29, 2015 14:14
Basic `document.readyState`/`script.readyState` tests
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Basic `document.readyState`/`script.readyState` tests</title>
<script id="loadFirst">
function getScriptIds(scriptEls) {
var scriptIds = [];
if (scriptEls) {
for (var i = 0, len = scriptEls.length; i < len; i++) {
@JamesMGreene
JamesMGreene / queryCommand.js
Last active August 29, 2015 14:06
An example of discovering if a queryCommand works in a cross-browser, old-browser compliant way.
function runQueryCommand(command, showUI, value) {
var commandWorked = false,
initialDesignMode = document.designMode || "off";
try {
document.designMode = "on";
commandWorked = !!(
document.queryCommandSupported(command) &&
document.queryCommandEnabled(command) &&
document.queryCommand(command, showUI, value)
@JamesMGreene
JamesMGreene / README.md
Last active August 29, 2015 14:02 — forked from cphoover/gist:6228063
Polyfill for `document.currentScript`. Demo @ http://jsfiddle.net/JamesMGreene/9DFc9/
@JamesMGreene
JamesMGreene / gitflow-breakdown.md
Last active April 16, 2024 16:36
`git flow` vs. `git`: A comparison of using `git flow` commands versus raw `git` commands.

Initialize

gitflow git
git flow init git init
  git commit --allow-empty -m "Initial commit"
  git checkout -b develop master

Connect to the remote repository

@JamesMGreene
JamesMGreene / clickToCopy_queryCommand.js
Last active August 29, 2015 14:01
An example of how synthetic click-to-"copy" events might look if we use `document.execCommand`.
var hasModernClipboardApi, queryCopySupported, syntheticCopySupported, button;
hasModernClipboardApi = window.ClipboardEvent != null;
try {
queryCopySupported = document.queryCommandSupported("click-to-copy") === true;
}
catch (e) {
queryCopySupported = false;
@JamesMGreene
JamesMGreene / npmVersionDilemma.md
Last active February 15, 2021 12:13
NPM/semver versioning dilemma

NPM Versioning Dilemma

Background on my Node module

  • I have an existing published Node module, flex-sdk, which basically serves as a downloader and wrapper for an external, non-JavaScript dependency: the Adobe/Apache Flex SDK.
  • As such, the Node module's version number is based on the version of the Flex SDK which it wraps, e.g. flex-sdk@4.5.1 == Flex SDK 4.5.1
  • I just discovered that I should also be bundling additional Flash API libraries (for compilation) with these various SDKs.

The Problem