Skip to content

Instantly share code, notes, and snippets.

View jordanrios94's full-sized avatar
😎
looking at a screen

Jordan Rios jordanrios94

😎
looking at a screen
  • 101Ways
  • London
View GitHub Profile
@jordanrios94
jordanrios94 / index.js
Last active April 1, 2018 12:40
react component parent and child states (jsx is an example, this is just showing how to update parent state)
class ParentComponent extends Component{
state = {
parentValue: ''
}
handleParentValueChange = (value) => {
this.setState({parentValue: value});
}
render() {
@jordanrios94
jordanrios94 / gist:bf20447c18207458b83bf389564123d1
Last active April 18, 2018 13:30
Scrolling Parent Window for iframes
// PARENT WINDOW
(function () {
function scrollWindow(evt) {
var message;
if (evt.origin !== "iframe_URL_HERE" ) {
message = "Action cannnot be performed";
} else {
var x = evt.data.xAxis || 0;
var y = evt.data.yAxis || 0;
@jordanrios94
jordanrios94 / gist:d69aa3ac7adc78a93962bc242e13ae8e
Created April 18, 2018 13:31
Iframe scrolling parent window
// IFRAME
(function () {
const scrollParentWindow = (x = 0, y = 0) => {
const parentWin = window.parent,
parentExpectedUrl = 'PARENT_URL_HERE',
currentParentUrl = `http://${parentWin.location.hostname}`
if (parentExpectedUrl === currentParentUrl) {
parentWin.postMessage({
xAxis: x,
@jordanrios94
jordanrios94 / requireAuth.js
Last active March 22, 2023 00:19
HOC Scaffold
import React, { Component } from 'react';
import { connect } from 'react-redux';
export default (ChildComponent) => {
class ComposedComponent extends Component {
// Our component just got rendered
componentDidMount() {
this.shouldNavigateAway();
}
@jordanrios94
jordanrios94 / index.js
Last active June 3, 2018 16:07
HOC Scaffold Redux
import React, { Component } from 'react';
import { connect } from 'react-redux';
export default (ChildComponent) => {
class ComposedComponent extends Component {
// Our component just got rendered
componentDidMount() {
this.shouldNavigateAway();
}

Progressive Framework Side-by-Side Intro

Vue or React. Well lets see the most noticeable features.


Application State Management

Vue

@jordanrios94
jordanrios94 / .travis.yml
Created August 8, 2018 13:54
Travis Node Tests Example
language: node_js
node_js:
- "node"
env:
- NODE_ENV=TEST
before_script:
- npm install
script:
- npm run test

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

sudo lsof -i :3000
kill -9 {PID}
@jordanrios94
jordanrios94 / multiFilter.js
Created September 6, 2018 10:38 — forked from jherax/arrayFilterFactory.1.ts
Filters an array of objects with multiple criteria.
/**
* Filters an array of objects with multiple criteria.
*
* @param {Array} array: the array to filter
* @param {Object} filters: an object with the filter criteria as the property names
* @return {Array}
*/
function multiFilter(array, filters) {
const filterKeys = Object.keys(filters);
// filters all elements passing the criteria