Skip to content

Instantly share code, notes, and snippets.

View rowlandekemezie's full-sized avatar
🏠
Working from home

Rowland I. Ekemezie rowlandekemezie

🏠
Working from home
View GitHub Profile
@rowlandekemezie
rowlandekemezie / 0Option2ConstructorSummary.md
Created November 29, 2016 12:20 — forked from allenwb/0Option2ConstructorSummary.md
New ES6 constructor features and semantics: Alternative 2 manual super in derived classes

New ES6 Constructor Semantics and Usage Examples

Manual super: Alternative Design where subclass constructors do not automatically call superclass constructors

This Gist presents a new design of class-based object construction in ES6 that does not require use of the two-phase @@create protocol.

One of the characteristics of this proposal is that subclass constructors must explicitly super invoke their superclass's constructor if they wish to use the base class' object allocation and initialization logic.

An alternative version of this design automatically invokes the base constructor in most situations.

@rowlandekemezie
rowlandekemezie / assignment.txt
Last active December 1, 2016 15:27
Discussion on Revealing module pattern in JS
Note: Totally optional.
Let's do this guys!
Write a calculator program that performs basic arithmetic operations.
Demonstrate how you can make private functions and public functions using revealing module pattern.
Use a markup page to get user input and render value accordingly.
@rowlandekemezie
rowlandekemezie / pipe.js
Created February 2, 2017 11:18
Write a function that takes multiple functions and pass the value of one to another
// Piping multiple functions
const _pipe = (f, g) => (...args) => g(f(...args));
const pipe = (...fns) => fns.reduce(_pipe);
const partials = (fn, ...args) => fn.bind(null, ...args);
const add2 = (...args) => args.reduce((a,b) => a + b);
const add3 = (a) => a + 6;
const add4 = (a, b) => a + b + 5;
@rowlandekemezie
rowlandekemezie / Reactor.js
Created February 21, 2017 10:19
Reactor created by rowland - https://repl.it/FqqB/1
function test (num) {
var holder = num.split('');
var sum = 0, i = 0;
var count = holder.length;
while(i < count) {
if(holder[i] === '-'){
sum = sum - holder[i + 1];
i += 2;
} else{
sum += parseInt(holder[i]);
-module(assignment).
-export([perimeter/1, area/1, enclose/1, bit/1]).
% perimeter implementation
perimeter({circle, R}) ->
2 * math:pi() * R;
perimeter({rectangle, H, W}) ->
2*(H + W);
@rowlandekemezie
rowlandekemezie / App.js
Last active July 4, 2017 04:29
Passing up data from Child Component to Parent Component
import React from 'react';
import { render } from 'react-dom';
import ChildA from './childA.js';
import ChildB from './childB.js';
class App extends React.Component {
handleKeyUp() {
console.log('Event bubbling: Passing up data from Child to Parent component');
}
render() {
@rowlandekemezie
rowlandekemezie / app.js
Created October 23, 2017 11:44 — forked from acdlite/app.js
Quick and dirty code splitting with React Router v4
// getComponent is a function that returns a promise for a component
// It will not be called until the first mount
function asyncComponent(getComponent) {
return class AsyncComponent extends React.Component {
static Component = null;
state = { Component: AsyncComponent.Component };
componentWillMount() {
if (!this.state.Component) {
getComponent().then(Component => {
@rowlandekemezie
rowlandekemezie / custom_radio_button.scss
Created January 17, 2018 18:52
My CSS trick in creating a custom radio button
input[type="radio"] {
position: absolute;
left: -9999px;
}
.label {
display: block;
position: relative;
margin-left: 0;
padding: 3px 0 3px 25px;
@rowlandekemezie
rowlandekemezie / range.js
Created January 29, 2018 21:53
Utility functions
// Create a range of values
function range(start, end) {
return Array.apply(null, Array(end - start + 1))
.map((_, index) => index + start);
}
@rowlandekemezie
rowlandekemezie / Instructions.js
Created March 10, 2018 19:05
Update and Delete request with redux-saga
/*
1) Depending on your experience, this is all you might need to do to hook up your workflow
2) Remember, not to copy and paste. My idea is to show you how things fit it to you can tailor it to your application
GRACIAS 💪
*/