Skip to content

Instantly share code, notes, and snippets.

View JamesMGreene's full-sized avatar

James M. Greene JamesMGreene

View GitHub Profile
@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 / .editorconfig
Created November 16, 2015 12:04
Example EditorConfig file
# 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
@JamesMGreene
JamesMGreene / ZC_AMD_Test.js
Last active February 11, 2024 22:53
Possible Node.js test for AMD support in ZeroClipboard
exports = {
"Test onLoad Event with AMD": function (test) {
test.expect(1);
var amdTester = (function() {
var amdCache = {
"zc": zeroClipboard
};
return function(depIds, cb) {
var depVals = depIds.map(function(id) { return amdCache[id]; });
@JamesMGreene
JamesMGreene / jetty-macros-for-ant-using-ant-contrib.xml
Created May 15, 2012 20:10
How to start and stop Jetty from Ant. Two versions: one using Ant Contrib, one without.
<!--
***********************
A more-correct version of the Ant script bits outlined on this blog post:
http://ptrthomas.wordpress.com/2006/10/10/how-to-start-and-stop-jetty-from-ant/
NOTE: This file's macrodefs use task definitions from the Ant Contrib library ("if", "then" and "else", in particular).
If you are not using the Ant Contrib library, you cannot use this version of the file.
***********************
@JamesMGreene
JamesMGreene / EventedDatastore.js
Last active June 26, 2021 09:57
Forcibly adding NeDB events by deriving from the Datastore prototype
// 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 / 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

@JamesMGreene
JamesMGreene / ZeroClipboard "Core" v2 API.md
Last active June 3, 2020 16:17
ZeroClipboard "Core" v2.0.0 API

ZeroClipboard v2.0.0 "Core" API Draft

Working draft of the API for the new ZeroClipboard "Core" sub-module in v2.0.0. This sub-module only provides the core Flash and clipboard injection facilities but none of the DOM, "Client", resizing, repositioning, etc. logic/code.

NOTE: A checked checkbox means that line item has already been implemented in the latest ZeroClipboard master branch.

API

@JamesMGreene
JamesMGreene / createCommit.js
Last active December 16, 2019 20:35
Pseudo-JS code for creating a commit via the GitHub API from a Probot app
// Getting tree
const { data: baseTree } = await client.gitdata.getTree({
owner: login,
repo: repo,
tree_sha: sha,
recursive: 1
})
const baseSha = baseTree.sha
const baseEntriesByPath = baseTree.tree.reduce((entriesByPath, entry) => {
@JamesMGreene
JamesMGreene / clipboard.js
Last active November 5, 2019 07:47
HTML Clipboard API clarification example
var btn = document.getElementById("copy-button");
btn.addEventListener("click", clickHandler, false);
btn.addEventListener("copy", copyHandler, false);
function clickHandler(e) {
e.target.dispatchEvent(new ClipboardEvent("copy"));
}
function copyHandler(e) {
e.clipboardData.setData("text/plain", "Simulated copy. Yay!");
var btn = document.getElementById("copy-button");
btn.addEventListener("click", clickHandler, false);
function clickHandler(e) {
var clip = new ClipboardEvent("copy");
clip.clipboardData.setData("text/plain", "foo");
clip.clipboardData.setData("text/html", "<b>foo</b>");
// CRITICAL: Must call `preventDefault();` to get this data into the system/desktop clipboard!!!
clip.preventDefault();