Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
Coding Octocat

Amir Off amiroffme-zz

:octocat:
Coding Octocat
View GitHub Profile
View Blog.js
import React, {useEffect, useContext} from 'react';
import axios from "../../api/axios";
import {Context} from '../../Store'
import Post from '../Post/Post';
import './Blog.css';
const Blog = () => {
View App.js
import React from 'react';
import Header from './components/Header/Header';
import Blog from './components/Blog/Blog';
import Store from './Store'
const App = () => {
return (
<Store>
View Store.js
import React, {createContext, useReducer} from "react";
import Reducer from './Reducer'
const initialState = {
posts: [],
error: null
};
const Store = ({children}) => {
View Reducer.js
const Reducer = (state, action) => {
switch (action.type) {
case 'SET_POSTS':
return {
...state,
posts: action.payload
};
case 'ADD_POST':
return {
...state,
@amiroffme-zz
amiroffme-zz / gulpfile.js
Last active Sep 17, 2018
Gulp.js Tasks File
View gulpfile.js
// Main build task
gulp.task('build', ['html', 'images', 'sass', 'js', (args.prod ? 'production' : 'development')], () => {
// Print build info
console.log(packageFile.name + ' "' + packageFile.description + '" v' + packageFile.version);
});
// Runs only for production build
gulp.task('production', () => {
console.log('This is a production build');
console.log('Please run the following script for deployment:');
@amiroffme-zz
amiroffme-zz / gulpfile.js
Last active Sep 17, 2018
Gulp.js Tasks File
View gulpfile.js
const ftp = require('vinyl-ftp');
const minimist = require('minimist');
const args = minimist(process.argv.slice(2));
gulp.task('deploy', () => {
const remotePath = '/amiroffme/';
const conn = ftp.create({
host: 'ftp.amiroff.me',
user: args.user,
password: args.password
@amiroffme-zz
amiroffme-zz / .travis.yml
Created Sep 17, 2018
Travis CI Build Script
View .travis.yml
// Setting environment language
language: node_js
// Using the lastest version of Node.js
node_js:
- node
// Script to install dependencies
before_script:
- npm install -g --silent
View esp8266-libraries-include.ino
#include "ESP8266WiFi.h">
#include "DHT.h"
View esp8266-network-connect.ino
const ssid = "YOUR_NETWORK_SSID";
const password = "YOUR_NETWORK_PASSWORD";
WiFi.begin(ssid, password);
You can’t perform that action at this time.