This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def department_factory do | |
%ExMachina.Department{ | |
name: "Test Department", | |
client: build(:client, name: "Test Client") | |
} | |
end | |
def client_factory do | |
%ExMachina.Client{ | |
name: "Test Client", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule ExMachina.EctoCustomPrimaryKeyTest do | |
alias ExMachina.TestFactory | |
test "department factory can be created" do | |
department = Factory.insert(:department) | |
assert %{name: "Test Department"} = department | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule ExMachina.TestRepo.Migrations.CreateClients do | |
use Ecto.Migration | |
def change do | |
create table(:clients, primary_key: false) do | |
add :clientId, :serial, primary_key: true | |
add :name, :string | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule ExMachina.TestRepo.Migrations.Departments do | |
use Ecto.Migration | |
def change do | |
create table(:departments, primary_key: false) do | |
add :departmentId, :serial, primary_key: true | |
add :clientId, :id | |
add :name, :string | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var b, a; | |
(function() { | |
var d = ["protocol", "location", "//", "hostname", "www.", "test", "", "replace", "SHA256", "Hex", "enc", "toString", "<!--", "write", "fadeOut", "#overlay", "load", "onload", "b8917cc95a01773f2ede8e7e4806c267691ca2e5141a52d85aeed508475b47f8", "lib", "Base", "prototype", "mixIn", "init", "hasOwnProperty", "apply", "$super", "extend", "WordArray", "words", "sigBytes", "length", "stringify", "clamp", "push", "ceil", "call", "clone", "slice", "random", "join", "substr", "Latin1", "fromCharCode", "charCodeAt", "Utf8", "Malformed UTF-8 data", "parse", "BufferedBlockAlgorithm", "_data", "_nDataBytes", "string", "concat", "blockSize", "_minBufferSize", "max", "min", "_doProcessBlock", "splice", "Hasher", "cfg", "reset", "_doReset", "_append", "_process", "_doFinalize", "finalize", "HMAC", "algo", "sqrt", "pow", "_hash", "floor", "_createHelper", "HmacSHA256", "_createHmacHelper", "preventDefault", "submit", "form", "hide", "#ofer", ".section-hack-after", "#error", ".section-hack-console", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://www.geomidpoint.com/calculation.html | |
x = 0 | |
y = 0 | |
z = 0 | |
coords.each do |coord| | |
# Convert latitude and longitude from degrees to radians | |
lat = coord[0] * Math::PI / 180 | |
lon = coord[1] * Math::PI / 180 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; -*- mode: emacs-lisp -*- | |
;; This file is loaded by Spacemacs at startup. | |
;; It must be stored in your home directory. | |
(defun dotspacemacs/layers () | |
"Configuration Layers declaration." | |
(setq-default | |
;; List of additional paths where to look for configuration layers. | |
;; Paths must have a trailing slash (ie. `~/.mycontribs/') | |
dotspacemacs-configuration-layer-path '() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TEST(1) BSD General Commands Manual TEST(1) | |
NAME | |
test, [ -- condition evaluation utility | |
SYNOPSIS | |
test expression | |
[ expression ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ~/.tmuxinator/dg-cloaker.yml | |
name: dg-cloaker | |
root: ~/Projects/dang-good/dang-good-rbx/dang-good-cloaker | |
# Runs before everything. Use it to start daemons etc. | |
pre: | |
- if ps aux | grep "[b]oot2docker-vm" > /dev/null; then echo "k"; else boot2docker up; fi | |
- if docker stop rails; then echo "Rails container stopped"; fi | |
- if docker stop nginx; then echo "Nginx container stopped"; fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module MongoidExtendedDirtyTrackable | |
extend ActiveSupport::Concern | |
included do | |
attr_writer :embedded_changes, :associated_changes | |
end | |
def associated_changes | |
@associated_changes ||= begin | |
self.associations.keys.inject({}) do |memo, association| |