Skip to content

Instantly share code, notes, and snippets.

🍷
coding

M S Morris msmfsd

🍷
coding
  • Developer
  • Melbourne, Australia
Block or report user

Report or block msmfsd

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
@msmfsd
msmfsd / Iframe.js
Last active Jul 18, 2019
React iframe component
View Iframe.js
/*
INIT: ensure Babel/Eslint/Flow is configured for ES Class Fields & Static Properties
JSX USAGE: <Iframe src='http://web.site' onLoad={myOnloadFunction}/>
*/
import React, { Component, PropTypes } from 'react'
import ReactDOM from 'react-dom'
class Iframe extends Component {
static propTypes: Object = {
@msmfsd
msmfsd / es7-async-await.js
Last active Nov 25, 2019
Javascript fetch JSON with ES7 Async Await
View es7-async-await.js
// Async/Await requirements: Latest Chrome/FF browser or Babel: https://babeljs.io/docs/plugins/transform-async-to-generator/
// Fetch requirements: Latest Chrome/FF browser or Github fetch polyfill: https://github.com/github/fetch
// async function
async function fetchAsync () {
// await response of fetch call
let response = await fetch('https://api.github.com');
// only proceed once promise is resolved
let data = await response.json();
// only proceed once second promise is resolved
@msmfsd
msmfsd / flattenDeep.js
Last active Jul 16, 2018
Flatten a n-dimensional nested Javascript array
View flattenDeep.js
/*
* Flatten deeply nested array without external library like Immutable
* Simplified ES6 version of lodash flattenDeep functionality
* Reference: https://lodash.com/docs#flattenDeep
* Requirements: Latest Chrome/FF browser or ES6 transpiler like Babel
*/
const INFINITY = 1 / 0
/*
* Utility flatten array function
@msmfsd
msmfsd / load-content.js
Last active Apr 27, 2016
ES6 class to load php/html/* content into a div via jQuery
View load-content.js
// USAGE:
// import LoadContent from './load-content.js';
// LoadContent.Load($('#myDiv'), 'http://myContent.php', { id:1, data:mydata }, callbackFunction);
// DEPENDANCIES: jQuery, Babel ES6
"use strict";
/*
* CLASS: LoadContent
* DESC: Load php/html/* content into a div via jQuery
*/
You can’t perform that action at this time.