Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

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

Greg Herbowicz herbowicz

🏠
Working from home
View GitHub Profile
@herbowicz
herbowicz / fidget-spinner-in-css.markdown
Created December 18, 2017 12:59
Fidget spinner in CSS
@herbowicz
herbowicz / Bar.js
Created February 22, 2018 22:26
Jest and Enzyme - shallow rendering
import React from 'react';
const Bar = (props) => (
<div className="hi">
This is Bar
</div>
);
export default Bar;
@herbowicz
herbowicz / Bar.js
Created February 22, 2018 22:50
Jest and Enzyme - shallow rendering
import React from 'react';
const Bar = (props) => (
<div className="bar">
This is Bar
</div>
);
export default Bar;
@herbowicz
herbowicz / saga.js
Created March 13, 2018 17:06
redux-thunk vs. redux-saga
import { call, put, takeEvery } from 'redux-saga/effects';
import {
API_BUTTON_CLICK,
API_BUTTON_CLICK_SUCCESS,
API_BUTTON_CLICK_ERROR,
} from './actions/consts';
import { getDataFromAPI } from './api';
export function* apiSideEffect(action) {
@herbowicz
herbowicz / time.js
Created March 30, 2018 04:56
time utility function
function time() {
const now = new Date(),
h = now.getHours(),
m = now.getMinutes(),
s = now.getSeconds()
return `${h === 0 ? 12 : h > 12 ? h - 12 : h}:${(m <= 9 && '0') + m}:${(s <= 9 && '0') + s} ${h >= 12 ? 'PM' : 'AM'}`
}
time()
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Holiday</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" media="screen" href="main.css" />
</head>
<body>
@herbowicz
herbowicz / assertJoi.js
Last active July 23, 2018 05:09
Joi validation example
const schema = Joi.number().min(18).max(130);
const age = 20;
Joi.assert(age, schema);
@herbowicz
herbowicz / index.html
Created April 18, 2019 16:20
Map Data Across the Globe - D3.js - FCC
<h1><a href="https://www.freecodecamp.org/challenges/map-data-across-the-globe" target="_blank">Map Data Across the Globe</a></h1>
<h3>FreeCodeCamp</h3>
<h5>Zoom in/out | Hover over the data point for additional data</h5>
<h5><a href="https://youtu.be/dJbpo8R47D0" target="_blank">Watch this tutorial</a></h5>
<div id="map"></div>
<div id="tooltip">
Name: <span id="name" class="info"></span><br>
Nametype: <span id="nametype" class="info"></span><br>
[
{
"date": "1/1/2018",
"high": 36,
"avg": 34,
"low": 32
},
{
"date": "1/2/2018",
"high": 44,
@herbowicz
herbowicz / index.html
Created May 14, 2019 10:03
Particles simplest demo
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
/* ---- reset ---- */ body{ margin:0; font:normal 75% Arial, Helvetica, sans-serif; } canvas{ display: block; vertical-align: bottom; } /* ---- particles.js container ---- */ #particles-js{ position:absolute; width: 100%; height: 100%; background-color: #666; background-image: url(""); background-repeat: repeat; background-size: cover; background-position: 50% 50%; } /* ---- stats.js ---- */ .count-particles{ background: #000022; position: absolute; top: 48px; left: 0; width: 80px; color: #13E8E9; font-size: .8em; text-align: left; text-indent: 4px; line-height: 14px; padding-bottom: 2px; font-family: Helvetica, Arial, sans-serif; font-weight: bold; } .js-count-particles{ font-size: 1.1em; } #stats, .count-particles{ -webkit-user-select: none; margin-top