Skip to content

Instantly share code, notes, and snippets.

Dave Methvin dmethvin

Block or report user

Report or block dmethvin

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@dmethvin
dmethvin / console.txt
Created Dec 20, 2017
eleventy test output on Windows 10
View console.txt
$ npm run test
> eleventy-cli@0.1.0 test C:\wamp\www\eleventy
> ava
107 passed
7 failed
TemplateRenderTest » EJS Render Include
View _ServiceWorker_for_github_pages.md

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 — forked from cem2ran/main.js
React Getting Started - How it should be!
View main.js
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"))
)
View reporter.js
( 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 );
}
View gist:766de2d37c163e5ec6d5
From: John Resig [mailto:jeresig@gmail.com]
Sent: Sunday, February 26, 2006 7:55 PM
To: Dave Methvin
Subject: Re: jQuery suggestions
> JQuery is incredibly useful. I just started playing with it yesterday
> and already I'm hooked. I know exactly *why* I like it so much too.
> Have you ever read Paul Graham's essay "Succinctness is Power"?
> http://www.paulgraham.com/power.html
> Read it, and your neck will be sore afterwards. That's what happens
View onMulti
function SomeWidget( $elem ) {
this.$elem = $elem;
}
SomeWidget.prototype = {
constructor: SomeWidget,
renderTo: function( target ) {
$( target ).append( this.$elem.on( "click mousemove", this ) );
},
View gist:43ffd1c743554e5c50ae
// Node-like signature with single callback, returns the XHR
$.xhrcb( url: String, complete: Function( err: Error, xhr: XHR, options: Object ) ): XHR;
$.xhrcb( options: Object, complete: Function( err: Error, xhr: XHR, options: Object ) ): XHR;
// Returns a Promise, throws an error if no Promise or shim
$.xhr( options: Object ): Promise
// See ticket http://bugs.jquery.com/ticket/14509 for `options`
// Thoughts:
@dmethvin
dmethvin / gist:4339862
Created Dec 19, 2012
Test case for node.js exec, particularly for Windows
View gist:4339862
#!/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);
View gist:4339308
#!/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=$?
View gist:3933593
<!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);
};
You can’t perform that action at this time.