Skip to content

Instantly share code, notes, and snippets.

Alex Muraro akmur

Block or report user

Report or block akmur

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
@akmur
akmur / share-urls.md
Created Jun 7, 2019 — forked from apisandipas/share-urls.md
Share url's for Facebook, Twitter, Pinterest and Linkedin with just get variables
View share-urls.md

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=<URL>&p[title]=<TITLE>

View index.stores.js
// 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
View user.reducers.js
// 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
View index.middleware.js
import axios from 'axios'
export function middlewareActions({ dispatch }) {
return next => action => {
if (action.type === 'USER_LOADED') {
dispatch({
type: 'STATUS_CHANGED',
payload: true
})
}
View index.actions.js
import axios from 'axios'
export function loadUser() {
// this will be used to trigger the reducer
return {
type: 'LOAD_USER'
}
}
export function loadNews() {
View User.js
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()
}
View index.js
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() {
View gist:caf80ae7f1b8643cb160c49dfc47defa
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 Aug 21, 2017 — 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).
View .eslintrc
{
// 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
@akmur
akmur / Tablet Resolutions Regex
Created Aug 8, 2017
Tablet Resolutions Regex
View Tablet Resolutions Regex
^([7-9][0-9][0-9]|[0-1][0-0][0-5][0-9])x([1-8][0-9][0-9]|[1-9][0-9][0-9][0-9])$
the first three groups of numbers are for 768 numbers, assuming you are not interested in mobiles for example
You can’t perform that action at this time.