Skip to content

Instantly share code, notes, and snippets.

View dennishall1's full-sized avatar

Dennis Hall dennishall1

View GitHub Profile
var gulp = require('gulp');
var browserify = require('browserify');
var notify = require('gulp-notify');
var source = require('vinyl-source-stream');
var watchify = require('watchify');
var plumber = require('gulp-plumber');
var less = require('gulp-less');
var csso = require('gulp-csso');
var watch = require('gulp-watch');
var envify = require('envify');
@dennishall1
dennishall1 / html2json.js
Last active August 29, 2015 14:20
HTML to JSON
var el = document.getElementById("test-node");
var json = marshal(el, {});
document.write('<pre>' + JSON.stringify(json).replace(/\}/g, "}\n") + '</pre>');
function marshal(element, object) {
var scope;
each(element.attributes, function(attr){
if(attr.nodeName === 'data-prop'){
object[attr.nodeValue] = element.innerText || element.src;
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
// http://docs.jquery.com/Plugins/Validation/Methods/email
email: function(value, element) {
// contributed by Dennis Hall
// simplified enough for ff2 to not choke
return this.optional(element) || /^\s*[^ <>]+@[^ <>]+\.[a-z]{2,9}\s*$/i.test(value);
},
email_multiple: function(value, element) {
// contributed by Dennis Hall
// simplified enough for ff2 to not choke
@dennishall1
dennishall1 / example-simple.js
Last active March 31, 2016 15:19
A Simple Component
var HelloMessage = React.createClass({
render: function() {
return <div>Hello, {this.props.subject}</div>;
}
});
ReactDOM.render(<HelloMessage subject="World" />, mountNode);
@dennishall1
dennishall1 / home.html
Last active March 31, 2016 15:34
A Simple Example, in Context
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Hello React</title>
<script src="https://fb.me/react-0.14.8.js"></script>
<script src="https://fb.me/react-dom-0.14.8.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.23/browser.min.js"></script>
</head>
<body>
<div data-react="HelloMessage">
<div data-prop="greeting">Hello</div>
<div data-prop="subject">World</div>
</div>
{
"componentName": "HelloMessage",
"props": {
"greeting": "Hello",
"subject": "World"
}
}
@dennishall1
dennishall1 / home.html
Last active April 1, 2016 15:47
A Simple Component, Plus SEO
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Hello React</title>
<script src="https://fb.me/react-0.14.8.js"></script>
<script src="https://fb.me/react-dom-0.14.8.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.23/browser.min.js"></script>
</head>
<body>
@dennishall1
dennishall1 / jira-sprint-stories.js
Created December 1, 2016 21:03
Get a list of sprint story #s + titles -- convenient to copy/paste into planning poker
// inspect the dom to obtain the sprintId, and update it below
sprintId = 267;
stories = [];
$$('[data-sprint-id="' + sprintId + '"] .ghx-issue-content').forEach(function(item){
stories.push([
item.querySelector('.ghx-key').innerText,
item.querySelector('.ghx-summary').innerText
].join(' '));
});
console.log(stories.join('\n'));