Skip to content

Instantly share code, notes, and snippets.

View tthew's full-sized avatar
👨‍🎨

Matt Richards tthew

👨‍🎨
View GitHub Profile
@tthew
tthew / angular-webpack-cssmodules-example.md
Last active March 28, 2016 13:01
An example of leveraging Webpack, cssmodules (via webpack + postcss) and Angular

A very basic / high-level example of how to use locally scoped cssmodules in Angular, via Webpack using the css-loader.

Read the cssmodules readme and the css-loader README for lots more high-level information. Also checkout the lower-level ICSS (interoperable css) spec/readme for the nitty gritty.

Tl;dr this approach solves many of the same problems BEM sets out to solve

This would require a refactor of existing codebases to use Webpack. But beyond that (which may or may not be trivial depending on many different factors) it appears to be a maintainable and scalable strategy.

Check out this gulp-webpack-angular-seed I put together some time ago as well as the this resume application and this mnutrition branch for examples o

Verifying that +_tthew is my blockchain ID. https://onename.com/_tthew

Keybase proof

I hereby claim:

  • I am tthew on github.
  • I am tthew (https://keybase.io/tthew) on keybase.
  • I have a public key ASDeXOF72RPI_ZMTk-KRr6HjDTwzIU4mvYRJb7ryHRT2fAo

To claim this, I am signing this object:

@tthew
tthew / freed.js
Last active December 24, 2017 12:43
Free yourself from the Facebook feed.
// ==UserScript==
// @name Freed
// @description Free yourself from the Facebook feed.
// @version 1
// @include https://www.facebook.com/*
// @grant GM_addStyle
// ==/UserScript==
GM_addStyle(`
div[role=feed] {
<ApiProvider> // attach observables to context
<router>
<blah>
<blah>
{connectApi(<ApiConnectedComponet />) // take context observerables and pass as props to component
</blah>
</blah>
</router>
</ApiProvider>
const useWindowResize = invokeImmediately => {
const [immediatelyInvoked, setImmediatelyInvoked] = useState(false);
const [rect, setRect] = useState({
innerWidth: undefined,
innerHeight: undefined
});
const set = useCallback(() => {
if (!window) return;
const { innerWidth, innerHeight } = window;