made with requirebin
Created
December 12, 2015 15:22
-
-
Save jcblw/e8ddf384f6b7e98860cc to your computer and use it in GitHub Desktop.
requirebin sketch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// require() some stuff from npm (like you were using browserify) | |
// and then hit Run Code to run it on the right | |
var domla = require('domla') | |
var div = domla.div | |
var str = 'hello http://google.com world https://onradpad.com' | |
var segments = str.match(/https?:\/\/\w+\.\w+/g) | |
console.log(segments) | |
document.body.appendChild(div({}, JSON.stringify(segments))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){module.exports=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","command","content","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","element","em","embed","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noframes","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","shadow","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","video","wbr"]},{}],domla:[function(require,module,exports){var DOM={},tags=require("./src/tags");module.exports=DOM;var makeArray=module.exports._makeArray=function makeArray(arr,slice){return Array.prototype.slice.call(arr,slice)};var addAttributes=module.exports._addAttributes=function addAttributes(el,attrs){var eventName,value;for(var key in attrs){value=attrs[key];if(key==="className"){el.className=value}else if(/^on/.test(key)&&typeof value==="function"){eventName=key.replace(/^on/,"").toLowerCase();el.addEventListener(eventName,value)}else{el.setAttribute(key,value)}}};var isElement=module.exports._isElement=function isElement(el){return el&&typeof el==="object"&&el.tagName?true:false};var createElement=module.exports._createElement=function createElement(tagName,attrs){if(!~tags.indexOf(tagName)){throw new Error("could not create "+tagName+" element it is not a valid tag")}var rest=makeArray(arguments,2),el=document.createElement(tagName);if(typeof attrs==="string"){rest.unshift(attrs);attrs={}}addAttributes(el,attrs);rest.filter(isElement).forEach(el.appendChild.bind(el));if(rest.length===1&&typeof rest[0]==="string"){el.textContent=rest[0]}return el};var addToDOM=module.exports._addToDOM=function addToDOM(tagName){DOM[tagName]=createElement.bind(null,tagName)};tags.forEach(addToDOM)},{"./src/tags":1}]},{},[]);var domla=require("domla");var div=domla.div;var str="hello http://google.com world https://onradpad.com";var segments=str.match(/https?:\/\/\w+\.\w+/g);console.log(segments);document.body.appendChild(div({},JSON.stringify(segments))); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "requirebin-sketch", | |
"version": "1.0.0", | |
"dependencies": { | |
"domla": "0.2.1" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- contents of this file will be placed inside the <body> --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- contents of this file will be placed inside the <head> --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment