Skip to content

Instantly share code, notes, and snippets.

Avatar

Reza Sadr wintorez

View GitHub Profile
@wintorez
wintorez / gmail_bookmarklet.txt
Last active Oct 18, 2017
Gmail bookmarklet
View gmail_bookmarklet.txt
javascript:(function()%7Bm='http://mail.google.com/mail/?view=cm&fs=1&tf=1&to=&su='+encodeURIComponent(document.title)+'&body='+encodeURIComponent(document.location);w=window.open(m,'addwindow','status=no,toolbar=no,width=575,height=545,resizable=yes');setTimeout(function()%7Bw.focus();%7D, 250);%7D)();
@wintorez
wintorez / .bash_profile
Created Oct 6, 2017
My default macOS .bash_profile
View .bash_profile
source ~/.git-prompt.sh
export PS1='\[\e[37m\]\w $(__git_ps1 "(%s)")\$\[\e[m\] '
export PATH="/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:$PATH"
eval "$(rbenv init -)"
alias subl="/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl"
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
@wintorez
wintorez / inject.js
Created Oct 6, 2017
Use these functions to inject JavaScript and StyleSheets using Console
View inject.js
var injectStyle = function(pathToStyle) {
var head = document.getElementsByTagName("head")[0];
var link = document.createElement("link");
link.type = "text/css";
link.rel = "stylesheet";
link.href = pathToStyle;
head.appendChild(link);
};
var injectScript = function(pathToScript) {
@wintorez
wintorez / hosts
Created Nov 1, 2017
my /etc/hosts file
View hosts
0.0.0.0 assets.adobedtm.com
0.0.0.0 cdn.clicktale.net
0.0.0.0 cdnssl.clicktale.net
0.0.0.0 pagead2.googlesyndication.com
0.0.0.0 tags.crwdcntrl.net
0.0.0.0 c.amazon-adsystem.com
0.0.0.0 pixel.quantserve.com
0.0.0.0 cdn.taboola.com
0.0.0.0 ad.doubleclick.net
0.0.0.0 widget.perfectmarket.com
@wintorez
wintorez / git_prune.bash
Last active Nov 17, 2017
Delete untracked local git branches
View git_prune.bash
git fetch -p && for branch in `git branch -vv | grep ': gone]' | awk '{print $1}'`; do git branch -D $branch; done
View memoize_react.jsx
import React from 'react';
import memoize from 'lodash/memoize';
const Heading = memoize((props) => (
<div className="heading">
<div className="App-header">
<h2>{props.title}</h2>
</div>
</div>
), (props) => {
@wintorez
wintorez / polyfills.js
Created Nov 29, 2017
My default polyfills file for React/Redux project
View polyfills.js
// Object.assign() is commonly used with React.
Object.assign = require('object-assign');
// requestAnimationFrame polyfill
require('raf/polyfill');
// console.* polyfill for old browsers
require('console-polyfill');
// smooth scroll support for scrollIntoView
@wintorez
wintorez / configureStore.dev.js
Created Nov 29, 2017
My default Redux configureStore file for development environment
View configureStore.dev.js
import { createStore, applyMiddleware } from 'redux';
import thunk from 'redux-thunk';
import { createLogger } from 'redux-logger';
import rootReducer from '../reducers';
import { composeWithDevTools } from 'redux-devtools-extension';
import reduxUnhandledAction from 'redux-unhandled-action';
const configureStore = (preloadedState) => {
const store = createStore(
rootReducer,
@wintorez
wintorez / configureStore.dev.js
Created Nov 29, 2017
My default Redux configureStore file for production environment
View configureStore.dev.js
import { createStore, applyMiddleware } from 'redux';
import thunk from 'redux-thunk';
import rootReducer from '../reducers';
import { createLogger } from 'redux-logger';
const configureStore = preloadedState => createStore(
rootReducer,
preloadedState,
applyMiddleware(
thunk,
@wintorez
wintorez / configureStore
Created Nov 29, 2017
Pick the correct Redux store configuration depending on the environment
View configureStore
if (process.env.NODE_ENV === 'production') {
module.exports = require('./configureStore.prod');
} else {
module.exports = require('./configureStore.dev');
}