This file contains hidden or 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
// Nice way, using matchMedia, no IE9 or below support | |
var media = "screen and (min-width: 720px)", | |
placeholderShort = "Short holder", | |
placeholderLong = "My quite long placeholder"; | |
$(window).resize(function(){ | |
if(window.matchMedia(media).matches) { | |
$('.element').attr('placeholder', placeholderLong); | |
} | |
else { | |
$('.element').attr('placeholder', placeholderShort); |
This file contains hidden or 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
$list = $('.collections__list'); | |
$item = $list.find('.list__item--is-selected'); | |
$prev = $item.prev(); | |
$prepended = false; | |
if ($(window).width() < 700 && $item.index() != 0 && !prepended) { | |
$list.prependTo('.collections__list'); | |
prepended = true; | |
} | |
else if ($(window).width() > 700 && prepended) { |
This file contains hidden or 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 items = "", | |
data = ["your json data"] | |
$.each(json, function(i, item){ | |
items += data[i] ; // simplest example | |
}); | |
// this is fine because a .each is synchronous and doesn't need a callback | |
$('[data-json-container]').append(items); |
This file contains hidden or 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 React, { Component, PropTypes } from 'react'; | |
import withStyles from 'isomorphic-style-loader/lib/withStyles'; | |
import s from './ProgressBar.scss'; | |
class ProgressBar extends Component { | |
render() { | |
const {completed} = this.props; |
This file contains hidden or 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 React, { Component, PropTypes } from 'react'; | |
import withStyles from 'isomorphic-style-loader/lib/withStyles'; | |
import s from './ProgressContainer.scss'; | |
class ProgressContainer extends Component { | |
constructor(props) { | |
super(props); | |
This file contains hidden or 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
// actions/index.js | |
/* Team actions */ | |
export function fetchTeams() { | |
const request = axios.get(`${ROOT_URL}/teams${ACCESS_TOKEN}`); | |
return { | |
type: FETCH_TEAMS, | |
payload: request | |
}; | |
} |
This file contains hidden or 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 babelPolyfill from "babel-polyfill"; | |
import koa from "koa"; | |
import koaProxy from "koa-proxy"; | |
import koaStatic from "koa-static"; | |
import gzip from "koa-gzip"; | |
import React from "react"; | |
import ReactDOM from "react-dom/server"; | |
import * as ReactRouter from "react-router"; | |
import * as history from "history"; | |
import Transmit from "react-transmit"; |
This file contains hidden or 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
{ | |
"email": "[email protected]", | |
"fields": { | |
"name": "A super dope client", | |
"website": "clientisgr8.com", | |
"subject": "Product redesign", | |
"budget": "$40,000", | |
} | |
} |
This file contains hidden or 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
# Put me in ~/.atom/snippets.cson | |
'.source.js': | |
'import connect': | |
'prefix': 'cn' | |
'body': "import {connect} from 'react-redux';" | |
'export connect': | |
'prefix': 'ecn' | |
'body': "export default connect(mapStateToProps)(${1:MyComponent});" | |
'import React + Component': |
OlderNewer