Skip to content

Instantly share code, notes, and snippets.

Geoff Goodman ggoodman

Block or report user

Report or block ggoodman

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
@ggoodman
ggoodman / README.md
Created Mar 26, 2019
Try Velcro in your browser's dev tools
View README.md

Check out Velcro for more information.

// Load the runtime
var V={},velcro=(()=>{V.V='Velcro' in window?Promise.resolve(Velcro):new Promise(resolve=>{V.S=document.createElement('script');V.S.src='https://unpkg.com/@velcro/runtime@0.1';V.S.onload=()=>resolve(Velcro);document.head.appendChild(V.S);});V.R=V.V.then(v=>v.createRuntime());return s=>V.R.then(r=>r.import(s))})();

// Render a simple React element to document.body
var React = await velcro('react'), ReactDOM = await velcro('react-dom'); ReactDOM.render(React.createElement('h1', null, 'Hello Velcro'), document.body);
View jwt-authz.js
'use strict';
const Assert = require('assert');
Assert.ok(module.webtask.secrets['jwt-scope'], 'The jwt-scope secret is required for the jwt-authz');
module.exports = () => {
const requiredScopes = module.webtask.secrets['jwt-scope'].split(/\s+/);
return function middleware(req, res, next) {
@ggoodman
ggoodman / README.md
Created Feb 11, 2015
Use bluebird.js with angular.js as a replacement for $q
View README.md
@ggoodman
ggoodman / README.md
Created Aug 29, 2014
Build system and folder structure of Plunker.NEXT
View README.md

The build system and directory structure for Plunker.NEXT

Tools used:

  • Angular.js
  • ui-router
  • Webpack
  • Less
  • Bower
  • npm
@ggoodman
ggoodman / commander.js
Created Apr 4, 2014
Angular commander
View commander.js
var _ = require("lodash");
module.exports =
angular.module("plunker.service.commander", [])
.factory("commander", [ "$q", "$injector", function ($q, $injector) {
var commands = {};
var service = {
addCommand: addCommand,
@ggoodman
ggoodman / README.md
Created Oct 11, 2013
Angular.js stop-propagation directive
View README.md

Stop event propagation in Angular.js

This directive allows you to stop propagation for any event supplied.

Lets say you have an ng-click handler on a button that is overlayed on top of an <a href></a> link. You cant your click handler to fire, but not the anchor tag's default action. What you need is to stop the propagation of the click event up to the anchor tag.

Usage

<div ng-click="handleContainingElementClick()">
@ggoodman
ggoodman / format.js
Created May 23, 2013
Importer format
View format.js
{
source: "http://whatever",
description: "Blah blah",
tags: [],
files: {
"index.html": {
filename: "index.html",
content: "<html>..."
},
...
@ggoodman
ggoodman / app.js
Last active Dec 15, 2015 — forked from evangalen/app.js
Angular + Jasmine
View app.js
var app = angular.module('plunker', []);
app.controller('MainCtrl', function($scope) {
$scope.name = 'World';
});
View index.html
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Plunker</title>
<link rel="stylesheet" href="style.css">
<script src="script.js"></script>
</head>
@ggoodman
ggoodman / app.js
Last active Dec 15, 2015
Ember Starter Kit
View app.js
App = Ember.Application.create({});
App.IndexRoute = Ember.Route.extend({
setupController: function(controller) {
controller.set('content', ['a', 'b', 'c']);
}
});
You can’t perform that action at this time.