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 / prototypalInheritance.js
Last active June 20, 2016 12:47
Awesome use of arguments and prototypal inheritance in javascript
// It's worthy of note that Javascript is not a class-oriented language. It's strength is in its native nature.
// Basically, Javascript is a prototypal language and thus uses prototypal inheritance for its operations.
// The example below is a tip of how the prototypal nature of javascript can be utilized
// Implementing the use of 'arguments' object to pass arguments to a funcion
function foo() {
bar.apply(null, arguments)
}
function bar(){
@rowlandekemezie
rowlandekemezie / introrx.md
Created September 24, 2016 20:25 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@rowlandekemezie
rowlandekemezie / benchmark.sh
Created October 23, 2016 21:19 — forked from peterjmit/benchmark.sh
Bash Benchmark Script (using time)
#!/bin/bash
# REQUIRES SUDO
# Benchmark runner
repeats=20
output_file='benchmark_results.csv'
command_to_run='echo 1'
run_tests() {
# --------------------------------------------------------------------------
In the [first part](https://pub.scotch.io/@rowland/build-a-media-library-with-react-redux-and-redux-saga-part-1) of this tutorial, we had a running app. We covered basic React setup, project workflow; defined basic components and configured our application's routes.
In part 2 of this tutorial, which is unarguably the most interesting part of building React/redux application, we will setup application state management with redux, connect our React components to the store, and then deploy to Heroku. We will walk through this part in eight steps:
1. Define Endpoints of interest.
2. Create a container component.
3. Define action creators.
4. Setup state management system.
5. Define async task handlers.
6. Create presentational components.
@rowlandekemezie
rowlandekemezie / registerSaga.js
Last active November 25, 2016 14:04
inject sagas into the store
// Initialize the saga middleware
const sagaMiddleware = createSagaMiddleware();
// Inject middleware to the store
const store = createStore(userReducer, applyMiddleware(sagaMiddleware));
// Run the sagas you defined.
// You would normally have a rootSaga were you register all your saga
// Or spread then in the run function.
sagaMiddleware.run(watchRequest);
@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);