Skip to content

Instantly share code, notes, and snippets.

@typesend
typesend / _redux.ex
Created January 15, 2018 04:34 — forked from rstacruz/_redux.ex
Redux.ex (elixir)
defmodule Redux do
@moduledoc """
Like redux.js, but more elixir-like
store = create_store fn state, action -> ... end
store |> get_state()
store |> dispatch(%{ type: "publish" })
"""
defstruct reducer: nil, state: nil
@typesend
typesend / _redux.ex
Created January 15, 2018 04:34 — forked from rstacruz/_redux.ex
Redux.ex (elixir)
defmodule Redux do
@moduledoc """
Like redux.js, but more elixir-like
store = create_store fn state, action -> ... end
store |> get_state()
store |> dispatch(%{ type: "publish" })
"""
defstruct reducer: nil, state: nil
defmodule Store do
@initializer_action %{type: "@@INIT"}
# Code your Mom calls
def start_link(reducer, initial_state \\ nil) do
GenServer.start_link(__MODULE__, [reducer, initial_state])
end
def get_state(store) do

Make it real

Ideas are cheap. Make a prototype, sketch a CLI session, draw a wireframe. Discuss around concrete examples, not hand-waving abstractions. Don't say you did something, provide a URL that proves it.

Ship it

Nothing is real until it's being used by a real user. This doesn't mean you make a prototype in the morning and blog about it in the evening. It means you find one person you believe your product will help and try to get them to use it.

Do it with style

To the members of the MIT community:

This past weekend, a distressing event disrupted the life of our campus community. I am writing now to share details about the incident and important information that affects us all.

The incident itself On Saturday, February 23 at 7:28 AM, the dispatch center at the Cambridge Police Department (CPD) received an electronic communication reporting an emergency at 77 Massachusetts Avenue. The communication came through a Sprint relay message service designed for people with hearing or speech impediments. The communication went on for more than 18 minutes, with a Sprint relay operator interacting with the caller and in turn communicating with a CPD dispatcher.

One minute into the communication, the caller reported someone with a “really big gun,” and “armor” who was “getting out of control.” The CPD dispatcher immediately sent CPD units and State Police to the site, and notified MIT Police.

Within two minutes of being notified, the first MIT Police units entered Buildi

@typesend
typesend / gist:2520726
Created April 28, 2012 17:42 — forked from starflyer59/gist:2505474
Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id
Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id
######### _stars.html.erb ###################
<div id="starRating">
<%= form_for(rating_ballot, :html => { :class => 'rating_ballot' }) do |f| %>
<%= f.label("value_1", content_tag(:span, '1'), {:class=>"rating", :id=>"1"}) %>
<%= radio_button_tag("rating[value]", 1, current_user_rating == 1, :class => 'rating_button') %>
<%= f.label("value_2", content_tag(:span, '2'), {:class=>"rating", :id=>"2"}) %>
<%= radio_button_tag("rating[value]", 2, current_user_rating == 2, :class => 'rating_button') %>