Skip to content

Instantly share code, notes, and snippets.

View msmfsd's full-sized avatar
🎤
metal

Guiltfilter Records msmfsd

🎤
metal
View GitHub Profile
@msmfsd
msmfsd / IAPHUB-settings.js
Last active April 6, 2022 14:39
IAPHUB settings
// VERSIONS
// "react-native": "0.63.3"
// "react-native-iap": "5.1.3"
// "react-native-iaphub": "6.0.3"
// OUR CODE
import Iaphub from 'react-native-iaphub';
// APP INIT
const iaphubInit = async () => {
@msmfsd
msmfsd / Iframe.js
Last active July 15, 2020 11:48
React iframe component
/*
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 February 4, 2024 17:38
Javascript fetch JSON with ES7 Async Await
// 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 July 16, 2018 08:53
Flatten a n-dimensional nested Javascript array
/*
* 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 April 27, 2016 02:04
ES6 class to load php/html/* content into a div via jQuery
// 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
*/