[10:57 PM] acemarke: so, the canonical "bad perf for React+Redux" example is a todo list of 10,000 items
[10:58 PM] Sinistral: I always thought passing an object through was just a typical JS pointer
[10:58 PM] acemarke: the trivially obvious store shape is a single array of all 10K todo objects
[10:58 PM] acemarke: with a single connected list component
[10:58 PM] Sinistral: eh, ignore me, finish
[10:59 PM] acemarke: the list's mapState retrieves the array, and the list component renders this.props.todos.map(todo => <TodoListItem todo={todo} /> )
[10:59 PM] acemarke: which works fine the first time around
[10:59 PM] acemarke: but if you edit, say, the "text" field in a single todo
[11:00 PM] acemarke: your reducer returns a new updated todo object inside of a new array reference, shallow-copied
[11:00 PM] Sinistral: You are re-drawing the enti...oh
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
// A Meteor CheatSheet for Iron-Router by Gentlenode.com (converted to JavaScript using http://js2.coffee) | |
// Original Gist: https://gist.github.com/LeCoupa/59738c28fdc9085b9212 | |
var AdminController, PostsEditController; | |
meteor add iron: router | |
meteor update iron: router | |
// Iron Router > Configuration |
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
var ClientRouter = Backbone.Router.extend({ | |
routes: { | |
'404': 'notfound', | |
'500': 'error', | |
'auth': 'auth', | |
'authCallback?oauth_token=:oauth_token&oauth_verifier=:oauth_verifier': 'authCallback', | |
'': 'defaultRoute' | |
}, | |
defaultRoute: function() { |
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 { ApolloLink } from 'apollo-link'; | |
export class CleanTypenameLink extends ApolloLink { | |
request (operation, forward) { | |
if (operation.variables) { | |
operation.variables = omitDeep(operation.variables, '__typename'); | |
} | |
return forward(operation); | |
} | |
} |
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
type BatchLoadFn<K, V> = (keys: Array<K>) => Promise<Array<V | Error>>; | |
type LoadAllFn<K, V> = () => Promise<Array<[K, V]>>; | |
type Options<K, V> = { | |
batch?: boolean, | |
cache?: boolean, | |
cacheMap?: CacheMap<K, Promise<V>>, | |
cacheKeyFn?: (key: any) => any | |
}; |
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
/* | |
* The re-use of the ZPL syntax and US Shipping Label | |
* - Provided as education example | |
* - Re-released by open source community under fair use | |
* - Fair use per US Copyright Act of 1976, 17 U.S.C. § 107 | |
* The ZPL Printer Language | |
* - Copyright © 2014 ZIH Corp (zebra.com) | |
* The JavaScript syntax (minus ZPL markdown) | |
* Copyright © 2015 QZ Industries, LLC (qz.io) | |
* Licence: LGPL 2.1 |
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
#include "FlyCapture2.h" | |
#include <opencv2/core/core.hpp> | |
#include <opencv2/highgui/highgui.hpp> | |
#include <iostream> | |
using namespace FlyCapture2; | |
int main() |
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
cd /Applications/Utilities/Terminal.app/Contents/Resources/Fonts/ | |
cp *.otf ~/Library/Fonts/ |
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 { ApolloServer, gql } from 'apollo-server-micro'; | |
const typeDefs = gql` | |
type Query { | |
sayHello: String | |
} | |
`; | |
const resolvers = { | |
Query: { |
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
#!/usr/bin/env bash | |
# check color support | |
colors=$(tput colors) | |
if (($colors >= 8)); then | |
red='\033[0;31m' | |
nocolor='\033[00m' | |
else | |
red= | |
nocolor= |
OlderNewer