in response to https://twitter.com/rem/status/342389221010587648
- Java (no emoticon is sad enough)
- Node (just for build, testing, cmd stuff at work / at home for nearly everything)
- Ruby (only for sass/compass & Vagrant)
- Backbone
- jQuery
import { createStore } from 'redux'; | |
import combineReducers from './combineReducers'; | |
let Store = createStore(combineReducers({ | |
reducerA(state = 0, action, waitFor){ | |
if ( action.type === 'TEST'){ | |
waitState = waitFor(waitFor.reducerB) | |
if ( waitState.reducerB === 5 ) | |
state = 10 |
Before reading: | |
This is a soft auth check. Auth check should always be done server side, if not, your rest api are not checking correctly for auth. | |
1. Auth is in the store. | |
You need to setup constants for AUTH_SET_TOKEN and AUTH_LOGOUT, | |
then create the action creators authSetToken(token) and authLogout() action creators. | |
Then setup a reducer that when AUTH_SET_TOKEN is dispatched, sets the internal state to {token: token}, | |
and when logout is dispatched, clears it. | |
Now setup a utility function isLoggedIn(state) function, that only checks in state.auth.token exists, this is a soft check. |
module DateTimeHelper | |
def format_date_range(date_range) | |
first = date_range.first | |
last = date_range.last | |
if same_day?(first, last) | |
"#{first.to_s(:month_day)}, #{first.year}" | |
elsif same_month?(first, last) | |
"#{first.to_s(:month_day)}-#{last.day}, #{last.year}" | |
else | |
"#{first.to_s(:month_day)}-#{last.to_s(:month_day)}, #{last.year}" |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Flexbox test</title> | |
<style> | |
@media screen and (min-width: 30em) { | |
body { | |
display: -webkit-box; | |
display: -moz-box; | |
display: -ms-box; |
.image-rounded { | |
border-radius: 4px; | |
display: inline-block; | |
} | |
.image-rounded img { | |
visibility: hidden; | |
} |
// Portable & reusable Events object, not too different from what is found | |
// in Backbone. | |
// | |
// (Credits @visionmedia) & Modified from: | |
// https://raw.github.com/component/emitter/master/index.js | |
var Events = { | |
// Cache all callbacks. | |
callbacks: {}, | |
// Listen on the given `event` with `fn`. |
// --- | |
// Sass (v3.2.9) | |
// --- | |
@mixin respond-to($queries...) { | |
$length: length($queries); | |
@for $i from 1 through $length{ | |
@if $i % 2 == 1 { | |
@media screen and (min-width: nth($queries, $i)) { |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Table Display test</title> | |
<style> | |
@media screen and (min-width: 30em) { | |
body { | |
display: table; | |
caption-side: top; | |
} |