Skip to content

Instantly share code, notes, and snippets.

module Card exposing (Model, view)
import Html exposing (Html, div, text, p)
import Html.Attributes exposing (class)
import Html.Events exposing (onClick)
import Debug
type alias Model =
{ name : String
@amencarini
amencarini / Seat.elm
Last active August 6, 2016 10:50
SeatSaver
module Seat exposing (Model, Msg, view, init, update)
import Html exposing (Html, text, li)
import Html.Attributes exposing (class)
import Html.Events exposing (onClick)
-- MODEL
type alias Model =
# This works
defmodule Resources do
defmacro __using__(resource) do
quote bind_quoted: [resource: resource] do
def one(resource, id), do: IO.puts "/api/#{resource}/#{id}"
end
end
end
defmodule MainApp do
defmodule Client do
defmacro __using__(resources: resources) do
for {singlular, plural} <- resources do
quote bind_quoted: [singlular: singlular, plural: plural] do
def one(singlular, id) do
get("/api/#{plural}/#{id}")
end
end
end
end
@amencarini
amencarini / gist:f3cbe987803eea12cce5
Last active August 29, 2015 14:02
Neo4j World Cup: Average goals per match in all World Cups
match (wc:WorldCup)-->(m:Match)
optional match (m)<--()-[:SCORED_GOAL]->(g:Goal)
return wc.name, (count(distinct g) * 1.0 / count(distinct m)) as average
order by wc.name desc
@amencarini
amencarini / gist:6945cfd0da525eb42e7d
Created June 18, 2014 19:07
Neo4j World Cup: Top scorers for England
match (s:Squad)--(player:Player)--()-[:SCORED_GOAL]->(g)
where s.name =~ "England.*"
return player.name, count(distinct g) as count
order by count desc
limit 10

Keybase proof

I hereby claim:

  • I am amencarini on github.
  • I am amencarini (https://keybase.io/amencarini) on keybase.
  • I have a public key whose fingerprint is DBE9 9C15 341C 4183 61D3 848E 8633 62E4 A8B0 EC24

To claim this, I am signing this object:

@amencarini
amencarini / long.txt
Last active January 4, 2016 05:29
1) Parse a list of words 2) Change words in a text if the word is contained in the list. The change should be from word to <word> 3) Print result
Collaboratively administrate empowered markets via plug-and-play networks. Dynamically procrastinate B2C users after installed base benefits. Dramatically visualize customer directed convergence without revolutionary ROI.
Efficiently unleash cross-media information without cross-media value. Quickly maximize timely deliverables for real-time schemas. Dramatically maintain clicks-and-mortar solutions without functional solutions.
Completely synergize resource sucking relationships via premier niche markets. Professionally cultivate one-to-one customer service with robust ideas. Dynamically innovate resource-leveling customer service for state of the art customer service.
Globally incubate standards compliant channels before scalable benefits. Quickly disseminate superior deliverables whereas web-enabled applications. Quickly drive clicks-and-mortar catalysts for change before vertical architectures.
Credibly reintermediate backend ideas for cross-platform models. Continually reintermediate integrated proce
@amencarini
amencarini / derandomizable_id.rb
Created December 24, 2012 13:30
A way to get non-random ids with mongoid based on object characteristics. May be useful for testing purposes (e.g.: mocking Solr indexing with FakeWeb).
module DerandomizableId
extend ActiveSupport::Concern
included do
before_create :set_id
end
def set_id
attrs = self.attributes
attrs.delete('_id')
->
alert('Hello World!')