- Install
osxfuse
:
brew cask install osxfuse
-
Reboot your Mac.
-
Install
ntfs-3g
:
defmodule ApiDataStructure do | |
defmodule User do | |
use Ecto.Schema | |
import Ecto.Changeset | |
alias ApiDataStructure.Profile | |
embedded_schema do | |
field :username, :string |
DELIMITER // | |
CREATE FUNCTION BIN_TO_UUID(b BINARY(16)) | |
RETURNS CHAR(36) | |
BEGIN | |
DECLARE hexStr CHAR(32); | |
SET hexStr = HEX(b); | |
RETURN LOWER(CONCAT( | |
SUBSTR(hexStr, 1, 8), '-', | |
SUBSTR(hexStr, 9, 4), '-', |
defmodule Utils.Time do | |
import Utils.Types, only: [str_to_int!: 1, str_to_float: 1] | |
import Utils.Enum, only: [enum_rx: 2] | |
# note for future | |
# https://hexdocs.pm/nimble_parsec/NimbleParsec.html | |
def iso_time_range(input) when is_binary(input) do | |
case String.split(input, "/") do | |
[stime, etime] -> |
rails plugin new elemental -d mysql --mountable -T --dummy-path=spec/dummy --skip-action-mailer -C --skip-turbolinks --skip-action-cable --skip-spring --skip-active-storage --skip-coffee --skip-yarn --api -p |
/* bring in configs, and backends, like db */ | |
/* const config = require('config') */ | |
let healthy = true | |
setInterval(() => { | |
// check db pools, maybe run a query, etc. | |
try { | |
if (db.check_health()) { // but do this with a timelimit that is less than check interval seconds | |
healthy = true |
# When working on a project with multiple developers master will get ahead of your work. | |
# To come in sync should you rebase? merge? what is a fast-forward? Lots of discussion | |
# is available on this, here are a few: | |
# https://hackernoon.com/git-merge-vs-rebase-whats-the-diff-76413c117333 | |
# https://www.atlassian.com/git/tutorials/merging-vs-rebasing | |
# | |
# I prefer a merge/fast-forward, rather than rebase. These helpers assist in that process. | |
# LMK your thoughts and if you know of a better way! Enjoy! |
[ | |
{ | |
"name": "Aboleth", | |
"meta": "Large aberration, lawful evil", | |
"Armor Class": "17 (Natural Armor)", | |
"Hit Points": "135 (18d10 + 36)", | |
"Speed": "10 ft., swim 40 ft. ", | |
"STR": "21", | |
"STR_mod": "(+5)", | |
"DEX": "9", |
def create_batch(conn, %{"people" => people_params}) do | |
changesets = Enum.map(people_params, fn class -> | |
Person.changeset(%Person{}, person) | |
end) | |
result = changesets | |
|> Enum.with_index() | |
|> Enum.reduce(Ecto.Multi.new(), fn ({changeset, index}, multi) -> | |
Ecto.Multi.insert(multi, Integer.to_string(index), changeset) | |
end) |
I read about this problem and thought I would try it. Later I found it is a question here too: | |
https://codility.com/programmers/lessons/1-iterations/binary_gap/ | |
My first instinct was, "I know regex can do this, but I hate regex" (Which is also a good reason to get better at regex). | |
I couldn't quite hoop the syntax so I moved on. Here is what I came up with: | |
def max_binary_gap(n) | |
max_gap = 0 | |
arr = n.to_s(2).chars | |
while arr.size > 2 do |
osxfuse
:brew cask install osxfuse
Reboot your Mac.
Install ntfs-3g
: