Real unit test (isolation, no children render)
Calls:
- constructor
- render
def create_batch(conn, %{"people" => people_params}) do | |
changesets = Enum.map(people_params, fn class -> | |
Person.changeset(%Person{}, person) | |
end) | |
result = changesets | |
|> Enum.with_index() | |
|> Enum.reduce(Ecto.Multi.new(), fn ({changeset, index}, multi) -> | |
Ecto.Multi.insert(multi, Integer.to_string(index), changeset) | |
end) |
<IfModule mod_headers.c> | |
RequestHeader set X-Prerender-Token "YOUR_ACCESS_TOKEN_HERE" | |
</IfModule> | |
<IfModule mod_rewrite.c> | |
RewriteEngine on | |
<IfModule mod_proxy_http.c> | |
RewriteCond %{HTTP_USER_AGENT} baiduspider|facebookexternalhit|twitterbot|rogerbot|linkedinbot|embedly|quora\ link\ preview|showyoubot|outbrain|pinterest|Slackbot|Slack-ImgProxy|Slackbot-LinkExpanding|Site\ Analyzer|SiteAnalyzerBot|Viber|Whatsapp|Telegram [NC,OR] | |
RewriteCond %{QUERY_STRING} _escaped_fragment_ |
Hi Nicholas,
I saw you tweet about JSX yesterday. It seemed like the discussion devolved pretty quickly but I wanted to share our experience over the last year. I understand your concerns. I've made similar remarks about JSX. When we started using it Planning Center, I led the charge to write React without it. I don't imagine I'd have much to say that you haven't considered but, if it's helpful, here's a pattern that changed my opinion:
The idea that "React is the V in MVC" is disingenuous. It's a good pitch but, for many of us, it feels like in invitation to repeat our history of coupled views. In practice, React is the V and the C. Dan Abramov describes the division as Smart and Dumb Components. At our office, we call them stateless and container components (view-controllers if we're Flux). The idea is pretty simple: components can't
/* The date/time conversion code is going to be moved outside the asynctask later, | |
* so for convenience we're breaking it out into its own method now. | |
*/ | |
private String getReadableDateString(long time){ | |
// Because the API returns a unix timestamp (measured in seconds), | |
// it must be converted to milliseconds in order to be converted to valid date. | |
SimpleDateFormat shortenedDateFormat = new SimpleDateFormat("EEE MMM dd"); | |
return shortenedDateFormat.format(time); | |
} | |
(function() { | |
// Do not use this library. This is just a fun example to prove a | |
// point. | |
var Bloop = window.Bloop = {}; | |
var mountId = 0; | |
function newMountId() { | |
return mountId++; | |
} |
Angular directive code to help resize/redraw non-responsive elements (like D3 charts) in a bootstrap responsive design when the window moves across bootstrap boundaries.
(I edited my boostrap to create an extra size for some 7" tablets and landscape phones @ 600px)
What do you think? Good? Bad? Ugly? How could it be better? What other options exist?
Credit to tagtree for the Rickshaw directive help: http://tagtree.tv/d3-with-rickshaw-and-angular