Skip to content

Instantly share code, notes, and snippets.

View dmethvin's full-sized avatar

Dave Methvin dmethvin

View GitHub Profile
@dmethvin
dmethvin / gist:1676346
Created January 25, 2012 13:51
Breakpoint on access to a property
function debugAccess(obj, prop, debugGet){
var origValue = obj[prop];
Object.defineProperty(obj, prop, {
get: function () {
if ( debugGet )
debugger;
return origValue;
},
@dmethvin
dmethvin / keybase.md
Created October 4, 2019 17:06
keybase.md

Keybase proof

I hereby claim:

  • I am dmethvin on github.
  • I am dmethvin (https://keybase.io/dmethvin) on keybase.
  • I have a public key ASBkITRlkLdlzLtYsnadEqxDipOdWqAvog0vAdgA9UxYJQo

To claim this, I am signing this object:

@dmethvin
dmethvin / console.txt
Created December 20, 2017 15:38
eleventy test output on Windows 10
$ npm run test
> eleventy-cli@0.1.0 test C:\wamp\www\eleventy
> ava
107 passed
7 failed
TemplateRenderTest » EJS Render Include

ServiceWorker for github pages

This is a ServiceWorker template to turn small github pages into offline ready app.

Why ?

Whenever I make small tools & toys, I create github repo and make a demo page using github pages (like this one).
Often these "apps" are just an index.html file with all the nessesary CSS and JavaScript in it (or maybe 2-3 html/css/js files). I wanted to cache these files so that I can access my tools offline as well.

Notes

Make sure your github pages have HTTPS enforced, you can check Settings > GitHub Pages > Enforce HTTPS of your repository.

@dmethvin
dmethvin / main.js
Created May 26, 2016 18:53 — forked from cem2ran/main.js
React Getting Started - How it should be!
import React from 'react'
import ReactDOM from 'react-dom'
const Hello = ({name}) => <h1>Hello {name}!</h1>
ReactDOM.render(
<Hello name={"vjeux"}/>,
document.body.appendChild(document.createElement("div"))
)
( function( factory ) {
if ( typeof define === "function" && define.amd ) {
define( "jquery-deferred-reporter", [ "jquery" ], factory );
} else if ( typeof module === "object" && module.exports ) {
module.exports = factory( require( "jquery" ) );
} else {
factory( jQuery );
}
@dmethvin
dmethvin / gist:4339862
Created December 19, 2012 19:46
Test case for node.js exec, particularly for Windows
#!/usr/bin/env node
var child = require("child_process");
child.execFile("git", [ "status" ], function( error, stdout ) {
console.log("==== result from child.execFile() ====");
if ( error ) {
console.error("ERROR: " + error);
}
console.log(stdout);
#!/bin/sh
basedir=`dirname "$0"`
case `uname` in
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/node_modules/grunt-cli/bin/grunt" "$@"
ret=$?
<!DOCTYPE html>
<head>
<title>Pusher Test</title>
<script src="http://js.pusher.com/1.12/pusher.min.js" type="text/javascript"></script>
<script type="text/javascript">
// Enable pusher logging - don't include this in production
Pusher.log = function(message) {
if (window.console && window.console.log) window.console.log(message);
};
dave@STUDLIO /c/inetpub/apache/trash
$ bower install sizzle
cygwin warning:
MS-DOS style path detected: C:\Users\dave\AppData\Roaming\npm/node
Preferred POSIX equivalent is: /c/Users/dave/AppData/Roaming/npm/node
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
bower cloning git://github.com/jquery/sizzle.git
bower caching git://github.com/jquery/sizzle.git