Skip to content

Instantly share code, notes, and snippets.

View anthify's full-sized avatar
💻
coding

Anthony O'Neill anthify

💻
coding
View GitHub Profile
@anthify
anthify / us-states.json
Created August 11, 2021 06:31 — forked from rhythnic/us-states.json
Name, abbreviation, and numeric code for all 50 US states and some territories.
[
{
"id": "01",
"name": "Alabama",
"abbr": "AL"
},
{
"id": "02",
"name": "Alaska",
"abbr": "AK"
[
{
"value": "AF",
"label": "Afghanistan"
},
{
"value": "AX",
"label": "Åland Islands"
},
export default [
{ value: "GBP", label: "🇬🇧 British Pound"},
{ value: "CAD", label: "🇨🇦 Canadian Dollar"},
{ value: "HKD", label: "🇭🇰 Hong Kong Dollar"},
{ value: "USD", label: "🇺🇸 U.S.A Dollar"},
{ value: "PHP", label: "🇵🇭 Philippine Peso"},
{ value: "DKK", label: "🇩🇰 Danish Krone"},
{ value: "HUF", label: "🇭🇺 Hungarian Forint"},
{ value: "CZK", label: "🇨🇿 Czech Koruna"},
{ value: "RON", label: "🇷🇴 Romanian Leu"},
@anthify
anthify / parseFilePath.js
Created September 16, 2019 13:53
Takes path string and returns directory, filename, and extension in object.
export default path => ({
dir: path.substring(0, path.lastIndexOf('/')),
filename: path.substring(path.lastIndexOf('/') + 1, path.lastIndexOf('.')),
ext: path.substring(path.lastIndexOf('.') + 1)
});
@anthify
anthify / premloop.js
Created August 16, 2019 11:48
Clue for Premier League Challenge...
let prem = {};
const tallyMatch = ({ team1, team2, score1, score2 }) => {
// Check to see if the `prem` object
// contains the team yet, and if not add it.
if (!prem[team1.name]) {
prem[team1.name] = { points: 0, name: team1.name };
}
if (!prem[team2.name]) {
prem[team2.name] = { points: 0, name: team2.name };
@anthify
anthify / rockpaperscissors.js
Created August 9, 2019 15:51
Solution: Rock, Paper, Scissors
const game = {
choices: ["rock", "paper", "scissors"],
rock: "scissors",
paper: "rock",
scissors: "paper"
};
const play = playerChoice => {
if (!game.choices.includes(playerChoice)) {
return `Player hasn't selected valid choice`;
@anthify
anthify / rockpaperscissors.js
Created August 9, 2019 10:18
Rock, Paper, Scissors!
const rockPaperScissors = usersHand => {
let computersHand;
let result;
// logic
return `
You ${result}, computer picked ${computersHand}
`;
}
@anthify
anthify / enzyme-helper.js
Created July 17, 2019 08:45
Wrapper for Enzyme and Styled Components
import React from 'react';
import { ThemeConsumer } from 'styled-components';
import { mount } from 'enzyme';
import theme from '../../app/theme';
/**
* find is object to provide quick short end element selectors
*/
export const find = subject => ({
attr: (attr, value, el = '') => subject.find(`${el}[${attr}="${value}"]`),
@anthify
anthify / .eslintrc
Last active May 3, 2019 08:11
React web app lint setup
{
"extends": ["airbnb", "prettier", "prettier/react"],
"parserOptions": {
"sourceType": "module",
"allowImportExportEverywhere": true
},
"env": {
"browser": true,
"node": true,
"jest": true
@anthify
anthify / pipe.js
Created May 2, 2019 07:18
Pipe function
export default (...fns) => x => fns.reduce((v, f) => f(v), x);