Skip to content

Instantly share code, notes, and snippets.

View a-m-dev's full-sized avatar

Ahmad Mirzaei a-m-dev

View GitHub Profile
import React, { PropTypes } from 'react'
class CoursesPage extends React.Component {
constructor(props) {
super();
this.state = {
course: {
title: ''
const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
module.exports = {
entry: {
app: './src/js/index.jsx'
},
class MyComponent extends Component {
constructor(props) {
super();
this.state = {
_data: {
must_known: [],
libs: [],
tools: [],
@a-m-dev
a-m-dev / Scroll Top Offset React
Last active July 10, 2018 19:37
scroll top in react using ReactDOM
import React from 'react'
import ReactDOM from 'react-dom'
import AroundIcons from './AroundIcons'
class ResumeComponent extends React.Component {
constructor(props) {
super();
window.onscroll = () => {
let wScroll = window.scrollY;
// Movement Parallax
document.querySelector('.logo').style.cssText = `transform: translate(0px, ${wScroll/2}%)`;
document.querySelector('.back-bird').style.cssText = `transform: translate(0px, ${wScroll/4}%)`;
document.querySelector('.fore-bird').style.cssText = `transform: translate(0px, -${wScroll/40}%)`;
var SmoothScrolling = {
timer: null,
stop: function() {
clearTimeout(this.timer);
},
scrollTo: function(id, callback) {
var settings = {
duration: 1000,
{
"name": "amdev",
"version": "1.0.0",
"description": "My Personal Website",
"main": "index.js",
"scripts": {
"dev": "webpack-dev-server -d --progress",
"build": "npm run clear && webpack -p",
"clear": "rimraf ./dist/*"
},
const AddDayForm = ({ resort, date , powder, backcountry }) => {
let _resort , _date , _powder , _backcountry
const handleSubmit = (e) => {
e.preventDefault()
const formValues = {
resort: _resort.value,
date: _date.value,
powder: _powder.checked,
/* .env file is the best place to store all your diffrent api endpoint
* this gist is explain hot tyo create one
* best of luck
*/
// #01 -----------------------------------------------------
// create .env file in your root directory and
// add your end points with different names to it like below
// in our case we have one endpoint ( this is base url )
// #01 creating action file (./src/js/actions/courseActions.js)
export function createCourse(course) {
return { type: 'CREATE_COURSE' , course }
}