Skip to content

Instantly share code, notes, and snippets.

Daniel Zuzevich DZuz14

Block or report user

Report or block DZuz14

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@DZuz14
DZuz14 / user-profile.js
Created Aug 22, 2019
User Profile Reducer
View user-profile.js
const initialState = {
submitting: false,
success: '',
error: '',
};
/**
* @function userProfile
*/
const userProfile = (state = initialState, action) => {
@DZuz14
DZuz14 / user-profile.js
Created Aug 22, 2019
User Profile Form With Action Creator
View user-profile.js
import React, { Component } from 'react';
import { submitProfileForm } from '../actions/profile-form';
export default class ProfileForm extends Component {
handleSubmit = e => {
e.preventDefault();
submitProfileForm();
};
render() {
@DZuz14
DZuz14 / user-profile.js
Last active Aug 22, 2019
User Profile Form, No Action Creator.
View user-profile.js
import React, { Component } from 'react';
import { submitProfileForm } from '../actions/profile-form';
export default class ProfileForm extends Component {
handleSubmit = e => {
e.preventDefault();
// Emit the action here!!!
};
render() {
@DZuz14
DZuz14 / signup-user.js
Last active Jun 25, 2019
Async Await Action Creator with Redux Thunk
View signup-user.js
const BACKEND_URL = 'https://fakeserver.com/api'
export function signUpUser(email, password) {
return async (dispatch) => {
try {
const signUp = await axios.post(`${BACKEND_URL}/signup`, {
email: email,
password: password
})
View x.json
{
"away": {
"stats": {
"Junis": [
"5.0",
"4",
"1",
"1",
"2",
"6",
@DZuz14
DZuz14 / pitchers.js
Created Apr 27, 2019
ESPN MLB Pitcher Duplicates
View pitchers.js
1.) Grab each pitcher from table and their stats.
- Store them in object like:
```
{
'C. Sale': [5,2,3],
'H. Martinez': [20,9,4],
'R. Martinez': [3,7,1],
'J. Schmoe': [20,25,99],
'R. Kelly': [20,9,4],
'P. Kelly': [3,7,1],
@DZuz14
DZuz14 / file.php
Created Jun 22, 2018
Save Craft 3 Entry With PHP
View file.php
<?php
$section = Craft::$app->sections->getSectionByHandle('journalArticles');
$entryTypes = $section->getEntryTypes();
$entryType = reset($entryTypes);
$entry = new Entry([
'sectionId' => $section->id,
'typeId' => $entryType->id,
'fieldLayoutId' => $entryType->fieldLayoutId,
@DZuz14
DZuz14 / async.js
Last active Jan 15, 2019
Async Await Promises
View async.js
function someCoolPromise() {
return new Promise((resolve, reject) => {
// You can do anything you want in here for as long as you want.
// Then just call the resolve function when you are ready.
for(let i = 0;i < 10000; i++) {
// weeeee
}
resolve({
@DZuz14
DZuz14 / example.js
Last active Dec 18, 2018
Real App.js Example
View example.js
import React, { Component } from 'react'
import Header from '~/components/header'
import Footer from '~/components/footer'
import Login from './login'
import Portfolio from '~/components/portfolio'
import { Switch, Route, Redirect } from 'react-router-dom'
import { ROOT_APP_URL } from '~/constants'
@DZuz14
DZuz14 / Slide.js
Last active Oct 4, 2018
Setting Background Image on Slide
View Slide.js
import React from 'react'
const Slide = ({ image }) => {
const styles = {
backgroundImage: `url(${image})`,
backgroundSize: 'cover',
backgroundRepeat: 'no-repeat',
backgroundPosition: '50% 60%'
}
return <div className="slide" style={styles}></div>
You can’t perform that action at this time.