Skip to content

Instantly share code, notes, and snippets.

Chase ChaseWest

Block or report user

Report or block ChaseWest

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
ChaseWest / react-table-component.js
Created May 24, 2014
React Table Component for creating a very basic html table
View react-table-component.js
var Table = React.createClass({
render: function render() {
var _self = this;
var thead = React.DOM.thead({},{}, (col) {
return{}, col);
ChaseWest / parse-HTML-without-DOMParser.js
Created May 10, 2014
Parse HTML string without DOMParser API
View parse-HTML-without-DOMParser.js
var HTML = "<div><span>Test</span></div>";
var body = document.querySelector("body");
function parseHTML(htmlString){
var frag = document.createDocumentFragment(),
el = document.createElement( "div" );
el.setAttribute("id", "wrapper");
el.innerHTML = HTML;
ChaseWest / HTML-parse.js
Created May 10, 2014
Parse HTML string to document object and insert into DOM
View HTML-parse.js
var HTML = "<div></span>Test</span></div>";
var body = document.querySelector("body");
function parseHTML(htmlString){
var parser = new DOMParser();
var fragment = document.createDocumentFragment();
fragment.appendChild(parser.parseFromString(htmlString, "text/html").querySelector("body"));
View is-function.js
function is(val, type){
case "finite":
return typeof val === "number" && Number.isFinite(val);
case "integer":
return typeof val === "number" && Number.isInteger(val);
case "NaN":
return typeof val === "number" && Number.isNaN(val);
case "positive":
ChaseWest / random-key.js
Last active Aug 29, 2015
Generate a random string (ex: "5ons00tkwfsnstt9")
View random-key.js
function getRandomKey(){
ChaseWest / attach-function.js
Created May 10, 2014
Generic pure js function to attach event listeners to DOM nodes
View attach-function.js
var is_attachEvent = !!document.attachEvent,
is_addEventListener = !!document.addEventListener;
function attach(target, event, fn){
case is_addEventListener:
target.addEventListener(event, fn);
case is_attachEvent:
target.attachEvent("on"+event, fn);
ChaseWest / loop-function.js
Last active Aug 29, 2015
Loop function to determine the loop type by the object passed in. Set - (Array/Object), fn - (function to call on each iteration), order - (if order doesn't matter and set is an array, then use a while loop)
View loop-function.js
function loop(set, fn, order){
var is_array = === '[object Array]',
i, l;
l = set.length;
if (!order) {
while(l--){ fn(l); }
else {
You can’t perform that action at this time.