Skip to content

Instantly share code, notes, and snippets.

View akmur's full-sized avatar

Alessandro Muraro akmur

View GitHub Profile
{
"Console Log": {
"prefix": "log",
"body": ["console.log(Date.now(), '${1:text}', ${1:text})"],
"description": "Console Log"
},
"Connect Redux": {
"prefix": ",con",
"body": ["import { connect } from 'react-redux'"],
"description": "Connect Redux"
@akmur
akmur / share-urls.md
Created June 7, 2019 11:32 — forked from apisandipas/share-urls.md
Share url's for Facebook, Twitter, Pinterest and Linkedin with just get variables

Creating share buttons with just URL's

Twitter

http://twitter.com/share?text=<TITLE>&url=<URL>

E.g. http://twitter.com/share?text=This+is+google+a+search+engine&url=https%3A%2F%2Fwww.google.com

Facebook

http://www.facebook.com/sharer.php?u=&amp;p[title]=

// importing basic redux packages
import { createStore, applyMiddleware, compose } from 'redux'
// importing our combined reducers
import combineReducers from '../reducers/index.reducers'
// importing our middleware
import { middlewareActions } from '../middleware/index.middleware'
// this is needed to be able to do ajax requests
import thunk from 'redux-thunk'
// the following line is used for the redux devtools chrome extension
const storeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose
// our initial state
const initialState = {
data: {},
isLoaded: false
}
const userReducer = (state = initialState, action) => {
if (action.type === 'USER_LOADED') {
return {
...state, // this copies the old state
import axios from 'axios'
export function middlewareActions({ dispatch }) {
return next => action => {
if (action.type === 'USER_LOADED') {
dispatch({
type: 'STATUS_CHANGED',
payload: true
})
}
import axios from 'axios'
export function loadUser() {
// this will be used to trigger the reducer
return {
type: 'LOAD_USER'
}
}
export function loadNews() {
import React, { Component } from 'react'
import { loadUser } from './redux/actions/index.actions'
// this is what matters for redux
import { connect } from 'react-redux'
class User extends Component {
componentDidMount() {
if (!this.props.user.isLoaded) {
this.props.loadUser()
}
import React from 'react'
import ReactDOM from 'react-dom'
import './styles.css'
import User from './User'
import News from './News'
import Status from './Status'
import { Provider } from 'react-redux'
import store from './redux/stores/index.stores'
function App() {
var first = 'https://google.com';
var second = 'https://bing.com';
var third = 'https://duckduckgo.com';
var fourth = 'https://yandex.com';
var fifth = 'https://qwant.com';
module.exports = { first, second, third, fourth, fifth };
@akmur
akmur / .eslintrc
Created August 21, 2017 10:52 — forked from cletusw/.eslintrc
ESLint Reset - A starter .eslintrc file that resets all rules to off and includes a description of what each rule does. From here, enable the rules that you care about by changing the 0 to a 1 or 2. 1 means warning (will not affect exit code) and 2 means error (will affect exit code).
{
// http://eslint.org/docs/rules/
"ecmaFeatures": {
"binaryLiterals": false, // enable binary literals
"blockBindings": false, // enable let and const (aka block bindings)
"defaultParams": false, // enable default function parameters
"forOf": false, // enable for-of loops
"generators": false, // enable generators
"objectLiteralComputedProperties": false, // enable computed object literal property names