Skip to content

Instantly share code, notes, and snippets.

View JamesMGreene's full-sized avatar

James M. Greene JamesMGreene

View GitHub Profile
@jan-warchol
jan-warchol / sync-history.sh
Last active February 4, 2024 04:52
Synchronize history across bash sessions
# Synchronize history between bash sessions
#
# Make history from other terminals available to the current one. However,
# don't mix all histories together - make sure that *all* commands from the
# current session are on top of its history, so that pressing up arrow will
# give you most recent command from this session, not from any session.
#
# Since history is saved on each prompt, this additionally protects it from
# terminal crashes.
@1Marc
1Marc / workshops-planning.md
Last active January 20, 2023 02:34
Workshop Planning

This gist is no longer in use.

@JamesMGreene
JamesMGreene / gitflow-breakdown.md
Last active May 3, 2024 12:32
`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 / 0 - README.md
Last active February 20, 2018 18:10
A brief example of the latest idea for communicating with PhantomJS from the client-side.

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 December 17, 2015 20:59
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.).
// 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 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]; });
@jeremyckahn
jeremyckahn / inherit-by-proxy.js
Created May 10, 2013 04:25
Proxy-based inheritance pattern in JavaScript.
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 June 11, 2018 10:53
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.
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 April 4, 2013 21:01
Data files for Google Code to GitHub issue reference transformation testing
***************************
* 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 March 22, 2013 12:45 — forked from vitallium/vs2012_fix.patch
Patch to fix PhantomJS build when running with VS2012
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)