Skip to content

Instantly share code, notes, and snippets.

View fjfish's full-sized avatar

Francis Fish fjfish

View GitHub Profile
defmodule EctoTest.Repo do
use Ecto.Repo, otp_app: :ecto_test
import Ecto.Query
def find_or_create_by(queryable, attrs) do
q = Enum.reduce(attrs, queryable, fn
{field, val}, query ->
query |> where([x], field(x, ^field) == ^val)
_, query -> query
@colindensem
colindensem / Gruntfile.coffee
Last active August 29, 2015 14:08
Ember - Grunt - Build - S3 - Redis - Rails Serve
module.exports = (grunt) ->
timestamp = Date.now().toString
gitSha ='<%= gitinfo.local.branch.current.shortSHA %>'
grunt.initConfig
env: grunt.file.readJSON '.env.json'
replace:
prod:
src: ['dist/*.html']