Skip to content

Instantly share code, notes, and snippets.

View kadmil's full-sized avatar
🧙‍♂️

Kadmil kadmil

🧙‍♂️
View GitHub Profile
@kadmil
kadmil / keybase.md
Created October 2, 2017 20:41
keybase.md

Keybase proof

I hereby claim:

  • I am kadmil on github.
  • I am kadmil (https://keybase.io/kadmil) on keybase.
  • I have a public key ASCJI0zBolUhj4THo0s8qlAiQAJpC7BoNAsKxP5ukpbX9go

To claim this, I am signing this object:

@kadmil
kadmil / first.jsx
Created July 10, 2016 15:08
React like a pro
import React from 'react'
export default (props) => (<div>{props.myText}</div>)
@kadmil
kadmil / utils.js
Last active May 30, 2016 06:25
Async utils
export const request = type => `${type}_REQUEST`
export const response = type => `${type}_RESPONSE`
export const fail = type => `${type}_FAIL`
@kadmil
kadmil / middleware.js
Last active May 30, 2016 06:21
API middleware
export const apiMiddleware = store => next => action => {
//use destructuring to get apiCall and request from action object
const {apiCall, request, ...actualAction} = action
//ignore normal actions
if (!apiCall) {
return next(action)
}
//dispatch request_begin action — maybe we'd like some loaders
@kadmil
kadmil / second.css
Created May 9, 2016 16:27
Name collision part 2
.title {
border: 1px solid red;
}
@kadmil
kadmil / my-component.jsx
Created May 9, 2016 16:25
My component with CSS Modules
import React from 'react'
import Styles from './my-component.css'
export default _ => (<div className={Styles.title}/>)
@kadmil
kadmil / composing.css
Created May 9, 2016 16:24
Composing with CSS Modules
.input {
border: none;
}
//use styles from the class in the file
.firstCustomInput {
composes: input;
}
//use styles from the class in '_input.css'
@kadmil
kadmil / global.css
Created May 9, 2016 16:23
Global CSS Modules namespacing
:global(.myClass) {
//here go styles for all .myClass classes
}
@kadmil
kadmil / my-component.css
Last active May 9, 2016 16:24
React component and CSS Modules
.title {
border: 1px solid red;
}
@kadmil
kadmil / module loaders.js
Last active May 9, 2016 16:20
Webpack to the rescue
{
test: /\.css$/,
loader: ExtractTextPlugin.extract(‘style-loader’, ‘!css-loader?modules&importLoaders=1!stylus-loader’)
},