Instantly share code, notes, and snippets.

View each.js
function Each(obj, fn) {
if (obj.length) for (var i = 0, ol = obj.length, v = obj[0]; i < ol && fn(v, i) !== false; v = obj[++i]);
else for (var p in obj) if (fn(obj[p], p) === false) break;
View react propTypes
propTypes: {
// You can declare that a prop is a specific JS primitive. By default, these
// are all optional.
optionalArray: React.PropTypes.array,
optionalBool: React.PropTypes.bool,
optionalFunc: React.PropTypes.func,
optionalNumber: React.PropTypes.number,
optionalObject: React.PropTypes.object,
optionalString: React.PropTypes.string,
View elixir_logger.ex
require Logger "path: " <> inspect(conn.params["paths"])
View make_fake.exs
alias SampleElixirEctoSelect.RssFeed 0..99,
fn _ ->
params = %{
feed_url: Faker.Internet.url,
title: Faker.Commerce.product_name,
View js_log.js
console.debug("%O", obj)
View ecto_gen_migration.ex
mix ecto.gen.migration add_posts_table
View phoenix auth model
mix phoenix.gen.json UserAuth user_auths email:string encrypted_password:string password:string type:string
View elixir_google_place.ex
defmodule GooglePlaces do
@moduledoc false
use HTTPoison.Base
#require Logger
@text_search "/textsearch/json?key=<api key>"
View rails g
# model
rails g model Company --no-migration -t rspec
# controller (page)
rails g controller Rules -t rspec
# scaffold
rails generate scaffold Plan -t rspec