This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#install FlameGraph library | |
cd /opt/ | |
sudo git clone https://github.com/brendangregg/FlameGraph.git | |
#make it accesible from any folder | |
vim ~/.bashrc | |
##add these lines anywhere and exit vim (if you can) | |
export FLAMEPATH=/opt/FlameGraph | |
PATH=$PATH:$FLAMEPATH | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const createMySocketMiddleware = (url) => { | |
return storeAPI => { | |
let socket = createMyWebsocket(url); | |
socket.on("message", (message) => { | |
storeAPI.dispatch({ | |
type : "SOCKET_MESSAGE_RECEIVED", | |
payload : message | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Shadow 0dp */ | |
box-shadow: none; | |
/* Shadow 1dp */ | |
box-shadow: 0 1px 1px 0 rgba(0,0,0,0.14), 0 2px 1px -1px rgba(0,0,0,0.12), 0 1px 3px 0 rgba(0,0,0,0.20); | |
/* Shadow 2dp */ | |
box-shadow: 0 2px 2px 0 rgba(0,0,0,0.14), 0 3px 1px -2px rgba(0,0,0,0.12), 0 1px 5px 0 rgba(0,0,0,0.20); | |
/* Shadow 3dp */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Dashboard extends Component { | |
constructor(props) { | |
super(props) | |
// bind? slows down the initialization path, looks awful | |
// when you have 20 of them (I have seen your code, I know) | |
// and it increases bundle size | |
this.handleStuff = this.handleStuff.bind(this) | |
// _this is ugly. |
Wasavi is some sort of vim implementation for browser text fields.
- Chrome extension: https://chrome.google.com/webstore/detail/wasavi/dgogifpkoilgiofhhhodbodcfgomelhe
- home page: http://appsweets.net/wasavi/
Once installed go to https://play.golang.org, you can use INSERT or CTRL+ENTER to enter the vim mode. To quit use the usual vim commands.
Tips:
- The default keybinding to enter vim mode, CTRL+ENTER, conflicts with the standard playground shortcuts (CTRL+ENTER to format, SHIFT+ENTER to run). I recommend configuring wasavi to not enter vim mode on CTRL+ENTER (just use INSERT or configure something else)
- Once you remapped CTRL+ENTER, you can have the following workflow:
Notes moved from graph-gophers/graphql-go#15
Graphql-js can parse directives like @live
just fine -
parsed.definitions[0].selectionSet.selections[0].selectionSet.selections[0].directives[0] =
{ kind: 'Directive',
name: { kind: 'Name', value: 'live', loc: { start: 26, end: 30 } },
arguments: [],
loc: { start: 25, end: 30 } }
Here's a sample scenario. Let's say we're using a "feature-first" folder structure based in /src
, and we're trying to use index.js
files to re-export files deeper in the hierarchy as a way of defining a sort of "public API" for a given feature folder. A sample of this might look like:
/features/A/ComponentA.jsx
export default ComponentA = () => (
<div>Component A</div>
);
/features/A/actions.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// v2 of the great example of SSE in go by @ismasan. | |
// includes fixes: | |
// * infinite loop ending in panic | |
// * closing a client twice | |
// * potentially blocked listen() from closing a connection during multiplex step. | |
package main | |
import ( | |
"fmt" | |
"log" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { mockServer, MockList } from 'graphql-tools'; | |
import casual from 'casual-browserify'; | |
// The GraphQL schema. Described in more detail here: | |
// https://medium.com/apollo-stack/the-apollo-server-bc68762e93b | |
const schema = ` | |
type User { | |
id: ID! | |
name: String |
NewerOlder