Skip to content

Instantly share code, notes, and snippets.

Avatar

James M. Greene JamesMGreene

View GitHub Profile
View workshops-planning.md

This gist is no longer in use.

@JamesMGreene
JamesMGreene / gitflow-breakdown.md
Last active May 5, 2021
A comparison of using `git flow` commands versus raw `git` commands.
View gitflow-breakdown.md

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 / 0 - README.md
Last active Feb 20, 2018
A brief example of the latest idea for communicating with PhantomJS from the client-side.
View 0 - README.md

A brief example of the latest idea for communicating with PhantomJS from the client-side.

This is the next revision of ideas discussed in a previous Gist:
    https://gist.github.com/JamesMGreene/3716654

This example demonstrates shimming in the new communication channels under discussion via existing methods (WebPage#onCallback and window.callPhantom).

The example does, however, take advantage of a yet-to-be-implemented EventEmitter API for core modules in the PhantomJS outer context. This API would add the following methods to core modules as appropriate:

  • on / addEventListener
@JamesMGreene
JamesMGreene / UsingPepperFlash.js
Last active Dec 17, 2015
A little code snippet to check if the current browser is enabled to use the Chromium built-in PPAPI (a.k.a. "Pepper") Flash Player, i.e. instead of the Adobe Flash Player (or some other player, e.g. Gnash, Klash, etc.).
View UsingPepperFlash.js
// NOTE: Some code taken from this StackOverflow question:
// http://stackoverflow.com/questions/12866060/detecting-pepper-ppapi-flash-with-javascript
var isUsingPepperFlash = (function() {
var getFlashPlayerFileName = function(mimeTypes, type) {
return (
mimeTypes &&
mimeTypes[type] &&
mimeTypes[type].enabledPlugin &&
mimeTypes[type].enabledPlugin.filename
@JamesMGreene
JamesMGreene / ZC_AMD_Test.js
Last active Dec 17, 2015
Possible Node.js test for AMD support in ZeroClipboard
View ZC_AMD_Test.js
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]; });
@jeremyckahn
jeremyckahn / inherit-by-proxy.js
Created May 10, 2013
Proxy-based inheritance pattern in JavaScript.
View inherit-by-proxy.js
function inherit (child, parent) {
function proxy () {};
proxy.prototype = parent.prototype;
child.prototype = new proxy();
};
function Parent () {}
function Child () {}
inherit(Child, Parent);
@JamesMGreene
JamesMGreene / phantomjs-xhr.js
Last active Jun 11, 2018
Example of (a) successfully executing a cross-domain XHR from the PhantomJS outer context to a wildcard CORS-enabled site; and (b) failing to execute a cross-domain XHR from the PhantomJS outer context to a site that is not CORS-enabled.
View phantomjs-xhr.js
var urls = [
/* Wildcard CORS enabled - Works in PhantomJS 1.9.0 */
'http://updates.html5rocks.com',
/* CORS disabled - Fails in PhantomJS 1.9.0 (and every other version) */
'http://www.google.com',
/* Hack workaround? */
/*
function(httpGet, callback) {
phantom.page.settings = (phantom.page.settings || {});
phantom.page.settings.webSecurityEnabled = false;
@JamesMGreene
JamesMGreene / issue-refs-match
Created Apr 4, 2013
Data files for Google Code to GitHub issue reference transformation testing
View issue-refs-match
***************************
* SHOULD BE REPLACED! *
***************************
Same project, issue, no octothorpe:
- Issue 7
- issue 7
- ISSUE 7
Same project, issue, with octothorpe:
@JamesMGreene
JamesMGreene / vs2012_fix.patch
Created Mar 22, 2013 — forked from vitallium/vs2012_fix.patch
Patch to fix PhantomJS build when running with VS2012
View vs2012_fix.patch
diff --git a/src/qt/src/3rdparty/webkit/Source/JavaScriptCore/wtf/HashSet.h b/src/qt/src/3rdparty/webkit/Source/JavaScriptCore/wtf/HashSet.h
index 82245f3..932d254 100644
--- a/src/qt/src/3rdparty/webkit/Source/JavaScriptCore/wtf/HashSet.h
+++ b/src/qt/src/3rdparty/webkit/Source/JavaScriptCore/wtf/HashSet.h
@@ -175,18 +175,20 @@ namespace WTF {
}
template<typename T, typename U, typename V>
- inline pair<typename HashSet<T, U, V>::iterator, bool> HashSet<T, U, V>::add(const ValueType& value)
+ inline pair<typename HashSet<T,U,V>::const_iterator, bool> HashSet<T,U,V>::add(const ValueType &value)
View vs2012_fix.patch
diff --git a/src/qt/src/3rdparty/webkit/Source/JavaScriptCore/wtf/HashSet.h b/src/qt/src/3rdparty/webkit/Source/JavaScriptCore/wtf/HashSet.h
index 82245f3..932d254 100644
--- a/src/qt/src/3rdparty/webkit/Source/JavaScriptCore/wtf/HashSet.h
+++ b/src/qt/src/3rdparty/webkit/Source/JavaScriptCore/wtf/HashSet.h
@@ -175,18 +175,20 @@ namespace WTF {
}
template<typename T, typename U, typename V>
- inline pair<typename HashSet<T, U, V>::iterator, bool> HashSet<T, U, V>::add(const ValueType& value)
+ inline pair<typename HashSet<T,U,V>::const_iterator, bool> HashSet<T,U,V>::add(const ValueType &value)