Skip to content

Instantly share code, notes, and snippets.

View ericadamski's full-sized avatar
💳
💤

Eric Adamski ericadamski

💳
💤
View GitHub Profile
@ericadamski
ericadamski / index.js
Last active December 20, 2018 20:55
Some fun with O(n) and Ellipsis 😜
function ellipsis(str, maxWords = 2) {
let i = 0;
let spaces = 0;
let result = "";
while (spaces < maxWords && i < str.length) {
const c = str.charAt(i++);
if (c == " ") ++spaces;
result += c;
}
@ericadamski
ericadamski / PROPOSAL.md
Created August 7, 2018 13:19
CFP: React Conf 2018

Why aren't You Abstracting with Redux Observable?

RxJS and Redux Observable have opened the door to the reactive programming paradigm in our frontend frameworks. Let’s take full advantage and “automate” many of the processes we do when requesting data from external APIs.

Outline

  • Intro
  • About Me
@ericadamski
ericadamski / send.js
Created September 6, 2017 13:49
Rx Marble Testing
export default function send(source$) {
reutrn source$.subscribe(({ fn }) => fn());
}
@ericadamski
ericadamski / clock-component-reducer.js
Last active February 8, 2017 16:32
So, you want to manage data in React?
/*
* File Name: clock-component-reducer.js
* The reducer always returns a new object so that Redux can compare
* the value of its current state to whatever the reducer returns
*/
export function timeReducer(state = {}, action) {
// Only evaluate the actions that are relavent to this componentReducer
switch (action.type) {
case 'GET_TIME':
@ericadamski
ericadamski / test-component.jsx
Last active February 8, 2017 15:33
So, you want to manage data in React?
/*
* File Name: clock-component.jsx
* The fetch is now replaces by an action creator call
*/
componentDidMount() {
// Call the action creator
this.props.getTime();
}
@ericadamski
ericadamski / clock-component-action.js
Last active February 8, 2017 16:22
So, you want to manage data in React?
/*
* File Name: clock-component-action.js
* A function that creates an action with the current time
*/
import moment from 'moment';
// Defining a constant that should never change!
const GET_TIME = 'GET_TIME';
export function getTime() {
@ericadamski
ericadamski / clock-component.jsx
Last active February 8, 2017 16:43
So, you want to manage data in React?
/*
* Filename: clock-component.jsx
* A snippet from a React component showing the component connecting to the Redux store
*/
// `Connect` is the component listening to the store for changes
export default connect(ClockComponent);
".source.speck":
Log:
prefix: "sclog"
body: "console.log(`${1} : ${${1}}`);"
@ericadamski
ericadamski / index.html
Created December 5, 2016 23:03 — forked from anonymous/index.html
Material UI Button
<h1>It's A Button! 😬</h1>
<button class="mui-button">
<div class="ripple"></div>
<p>click me!</p>
</button>
@ericadamski
ericadamski / .-Web-Dev-Tutorial.md
Last active June 6, 2016 15:25
Beginner Web Development