Skip to content

Instantly share code, notes, and snippets.

View peterpme's full-sized avatar
🏠
Working from home

Peter Piekarczyk peterpme

🏠
Working from home
View GitHub Profile
@peterpme
peterpme / apollo-tote-loading.js
Created October 10, 2017 18:31
Apollo Tote Loading
<ApolloTote
query={`
query {
user {
imageUrl
}
}
`}
renderLoading={() => <Avatar.Loading />}
render={value => <Avatar imageUrl={value.user.imageUrl} />}
@peterpme
peterpme / apollo-tote-authorization.js
Last active October 10, 2017 18:29
Apollo Tote Examples
<ApolloTote
query={`
query {
user {
id
}
}
`}
test={data => !!(data && data.user && data.user.id)}
handleFail={() => Store.dispatch({ type: 'LOG_OUT' })}
@peterpme
peterpme / config
Created November 11, 2016 17:02
SSH Config Taken From Paul Irish. Thanks Paul!
# symlink to ~/.ssh/config
Host github.com
ControlMaster auto
ControlPersist 120
Host *
# Always use SSH2.
Protocol 2
@peterpme
peterpme / binding-answer.es6
Last active August 26, 2016 15:49
How can I pass both the key and the value without resorting to bind?
const handleFieldUpdate = (key) => (value) => setState({ [key]: value })
const SomeForm = () => (
<Input
placeholder='Name'
onChange={handleFieldUpdate('name')}
/>
)
const Input = ({
@peterpme
peterpme / styles.less
Last active June 23, 2021 06:24
Operator Mono and Fira Code working together in Atom
// ...
atom-workspace,
atom-text-editor {
font-family: "Fira Code";
text-rendering: optimizeLegibility;
font-size: 17px;
font-weight: 400;
line-height: 1.8;
}
@peterpme
peterpme / nvm-install.sh
Last active January 26, 2016 16:57
Given a `.nvmrc` file within your directory, automatically install the required node version
# belongs in ~/.zshrc
#chpwd is a zsh hook
function chpwd() {
[ -e .nvmrc ] && nvm install
}
@peterpme
peterpme / state.es6
Last active January 18, 2016 21:56
Click Handlers in React
class Hello extends React.Component {
constructor() {
this.handleIncrement = this.handleIncrement.bind(this)
this.state = {
currentIndex: 0
}
}
@peterpme
peterpme / envvars.zsh
Created November 12, 2015 02:09
Dumping Environment Variables to Heroku from a .env (dotenv) file
for env in `cat .env`;
do heroku config:set $env;
done;
@peterpme
peterpme / herokuupgrade.zsh
Created October 25, 2015 21:02
Upgrade your old school Heroku apps that aren't on the new Cedar 14 stack
#!/usr/bin/zsh -e
sites=('your' 'array' 'of' 'sites')
for i in $sites; do
echo "$i\n------"
cd $i
heroku stack:set cedar-14
git commit --allow-empty -m "Upgrading to Cedar-14"
git push origin master
{
"parser": "babel-eslint",
"plugins": ["react"],
"env": {
"es6": true,
"browser": true,
"node": true,
"mocha": true
},
"rules": {