Skip to content

Instantly share code, notes, and snippets.

View tdreyno's full-sized avatar

Thomas Reynolds tdreyno

  • Portland, OR
  • 13:19 (UTC -07:00)
View GitHub Profile
import React from 'react';
import { stylesheet, css } from '../../util';
import {
MEDIUM_COLOR,
LIGHT_PRIMARY_TEXT_COLOR,
BUTTON_LINK_TYPE,
LIGHT_COLOR,
} from '../../styles';
const STYLES = stylesheet({
import {
StyleSheet,
css as stylesheetToClassNames,
} from 'aphrodite';
import { Map } from 'immutable';
const Prefixer = require('inline-style-prefixer');
import { DEVELOPMENT } from '../config';
const prefixer = new Prefixer({ userAgent: navigator.userAgent });
{
"rules": {
"align": [true, "parameters", "statements"],
"arrow-parens": true,
"class-name": true,
"comment-format": [
true,
"check-space"
],
"curly": true,
const country = (seg) => /^[a-z]{2}$/.test(seg);
const midPrefix = (seg) => /^m|g$/.test(seg);
const midValue = (seg) => /^[a-zA-Z0-9_]+$/.test(seg);
const coMidPrefix = (seg) => /^m|g$/.test(seg);
const coMidValue = (seg) => /^[a-zA-Z0-9_]+$/.test(seg);
const darkNews = (seg) => seg === DARK_LABEL;
const year = (seg) => /^[0-9]{4}/.test(seg);
const month = (seg) => /^[0-9]{2}/.test(seg);
const day = (seg) => /^[0-9]{2}/.test(seg);
@tdreyno
tdreyno / config.rb
Created August 3, 2011 23:22
Latex 2 PDF Middleman
# Find all markdown files
path = File.join(File.dirname(__FILE__), "source", "**/*.html.markdown")
# Also generate .latex files along side
Dir[path].each do |markdown_file|
http_path = markdown_file.split("source").last.gsub(".html.markdown", "")
page "#{http_path}.latex", :proxy => "#{http_path}.html", :latex => true, :layout => false
end
require "fileutils"
(defn home-api-map
[]
{ :banner (model/pick :banner {:where {:slug "home"}})
:intro-headline (model/pick :headline {:where {:slug "intro"}})
:intro-slides (model/gather :slides {:where {:slug "intro"} :include {:slides {}}})
:intro-highlights (model/gather :highlight {:where {:slug "intro"}})
:tenants (model/gather :tenant)
:partners (model/gather :neighborhood-partner)
:whats-here-headline (model/pick :headline {:where {:slug "whats-here"}})
@tdreyno
tdreyno / ajax.cljs
Created September 2, 2013 02:24
Parallel json loading in CLJS
(defn load-json-channels-in-parallel
[channels]
(let [ch (chan)]
(go
(loop [open-channels channels
data {}]
(if (empty? open-channels)
(do
(>! ch data)
(close! ch))
@tdreyno
tdreyno / body-class.cljs
Created August 30, 2013 01:12
Port of hoverable body class support from JS to CLJS
(defn setup-scroll-watcher
[body-class]
(let [body-class (name body-class)
listener (shared/listen js/window :scroll)
debounced (shared/debounce listener 200)]
(dom/add-class! (.-body js/document) body-class)
(go
(loop []
// Option A
.slide-show__paging-button--next {
float: right;
}
// Option B
.Slideshow-pagingButton--next {
float: right;
}
@mixin hoverable {
.hover &:hover {
@content;
}
}
#elem {
@include hoverable {
font-weight: bold;
}