Skip to content

Instantly share code, notes, and snippets.

View stolinski's full-sized avatar
💭
Syntax.fm

Scott Tolinski stolinski

💭
Syntax.fm
View GitHub Profile
@stolinski
stolinski / keybindings.json
Created June 21, 2017 23:10
VSCode Tab Switching Keybindings
[
{ "key": "ctrl+1", "command": "workbench.action.focusFirstEditorGroup" },
{ "key": "ctrl+2", "command": "workbench.action.focusSecondEditorGroup" },
{ "key": "ctrl+3", "command": "workbench.action.focusThirdEditorGroup" },
{ "key": "cmd+1", "command": "workbench.action.openEditorAtIndex1" },
{ "key": "cmd+2", "command": "workbench.action.openEditorAtIndex2" },
{ "key": "cmd+3", "command": "workbench.action.openEditorAtIndex3" },
{ "key": "cmd+4", "command": "workbench.action.openEditorAtIndex4" },
{ "key": "cmd+5", "command": "workbench.action.openEditorAtIndex5" },
{ "key": "cmd+6", "command": "workbench.action.openEditorAtIndex6" },
@stolinski
stolinski / styled-components.md
Last active July 11, 2017 23:58
Thoughts On Styled Components

Pro

  • Clean syntax. is better than
  • Fast
  • React-like mindeset when styling, not every react component needs to be more than just styles.

Cons

  • 1 more thing to organize in JS
@stolinski
stolinski / server.js
Last active July 27, 2017 21:44
Meteor Server Route Without Package
// ___ _
// | | _| |_
// | | |_ _|
// | | |_|
// | |___
// | |
// |_______|
//
// https://www.leveluptutorials.com/
// @leveluptuts
alias l="ls -la"
alias add="git add ."
alias com="git commit -m"
alias push="git push"
alias start="npm run start"
alias deploy="npm run deploy"
alias in="npm install --save"
# FYI these are for FishShell, I'm not entirely sure of Bash or ZSH alias syntax but you get the idea.
@stolinski
stolinski / react-cloudinary.js
Created October 18, 2017 14:23
Client side Image Upload To Cloudinary React Dropzone
// get's called from react dropzone when file is dropped
onImageDrop = (files) => {
this.handleImageUpload(files[0]);
}
async handleImageUpload(file) {
const data = new FormData();
data.append('file', file);
data.append('upload_preset', CLOUDINARY_UPLOAD_PRESET);
const upload = await fetch(CLOUDINARY_UPLOAD_URL, {
@stolinski
stolinski / ssr-init.js
Last active February 3, 2018 18:07
Not working SSR Config GraphQL & Meteor
import React from 'react';
import { renderToNodeStream } from 'react-dom/server';
import { StaticRouter } from 'react-router';
import { ServerStyleSheet } from 'styled-components';
import { onPageLoad } from 'meteor/server-render';
import { Helmet } from 'react-helmet';
import 'isomorphic-fetch';
// Apollo
import { ApolloProvider, getDataFromTree } from 'react-apollo';
import { ApolloClient, Observable } from 'apollo-client';
@stolinski
stolinski / index.js
Last active December 22, 2017 17:32
Link State Meteor Not Working
const httpLink = new HttpLink({ uri: Meteor.absoluteUrl('graphql') });
const authLink = new ApolloLink((operation, forward) => {
const token = Accounts._storedLoginToken(); // from local storage
operation.setContext(() => ({
headers: {
'meteor-login-token': token,
},
}));
return forward(operation);
});
@stolinski
stolinski / index.js
Created December 28, 2017 22:07
apollo-linkp-state
const httpLink = new HttpLink({ uri: Meteor.absoluteUrl('graphql') });
const authLink = new ApolloLink((operation, forward) => {
const token = Accounts._storedLoginToken(); // from local storage
operation.setContext(() => ({
headers: {
'meteor-login-token': token,
},
}));
return forward(operation);
});
@stolinski
stolinski / eslint.json
Created March 2, 2018 02:32
React For Everyone esline
{
"parser": "babel-eslint",
"env": {
"browser": true,
"es6": true
},
"settings": {
"ecmascript": 6,
"jsx": true
},
@stolinski
stolinski / mockMang.js
Created April 9, 2018 17:27
Level Up Tutorials MockMang
import { makeExecutableSchema, addMockFunctionsToSchema } from 'graphql-tools';
import { graphql } from 'graphql';
import GraphQLMock from 'graphql-mock';
import typeDefs from 'imports/startup/both/typeDefs';
// Make a GraphQL schema with no resolvers
const schema = makeExecutableSchema({ typeDefs });
// Creates random id
const revisedRandId = () =>