How to configure intellij file watchers to run the elixir formatter.
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
# crazy shell command | |
find lib/dpi_web/live -name '*_chart.ex' | xargs ghead -q -n 1 | cut -d " " -f 2 | xargs -I % echo "echo '>>> %'; grep -R -E '(import|alias) %' lib/dpi_web/live;" | sh | |
# let's break it down | |
find lib/dpi_web/live -name '*_chart.ex' | |
# search for files like '*_chart.ex' starting in the lib/dpi_web/live directory | |
| xargs ghead -q -n 1 | |
# take the first line of those file, and don't tell me the name of the file | |
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
date -j -v -90d |
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
// Place your key bindings in this file to override the defaultsauto[] | |
[ | |
{ | |
"key": "ctrl+alt+cmd+r", | |
"command": "exunit.runPrevious" | |
}, | |
{ | |
"key": "ctrl+alt+cmd+a", | |
"command": "exunit.runAll" | |
}, |
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
{ | |
"Print File Line": { | |
"prefix": "pfl", | |
"body": [ | |
"IO.puts \"#{__ENV__.file}:#{__ENV__.line}\"" | |
] | |
}, | |
"Inspect Value": { | |
"prefix": "iiv", | |
"body": [ |
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 handle_event("name-change", params, socket) do | |
# 1. fetch the previously assigned changeset | |
export_changeset = socket.assigns.export_changeset | |
# 2. apply the changes | |
export_changeset = Export.changeset(export_changeset, params["export"]) | |
# 3. the parent changeset is invalid, and there are errors in the child (embedded) changesets, | |
# but the parent changeset does not have errors | |
# 4. `apply_action` sets the action, and possibly other changes on the changeset | |
case Ecto.Changeset.apply_action(export_changeset, :insert) do | |
{:ok, data} -> |
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
# These jq scripts were developed to deal with geojson files generated with https://rubygems.org/gems/advance | |
# This adds the filename to the path data and pipes it to less for viewing: | |
jq '. + {source_data: { features: [.source_data.features[] + {file: input_filename}]}}' some_geojson.json | less | |
# This pipes it to a new file: | |
jq '. + {source_data: { features: [.source_data.features[] + {file: input_filename}]}}' some_geojson.json > new_file.json | |
# To extract just the features while adding the filename: | |
jq '{features: [.source_data.features[] + {file: input_filename}]}' some_geojson.json > features.json |
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 first_singleton(list) do | |
list | |
|> Enum.sort() | |
|> no_partner?() | |
end | |
def no_partner?([value | remaining_values]) do | |
if value == hd(remaining_values) do | |
Enum.reject(remaining_values, &(&1 == value)) | |
|> no_partner?() |
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
#!/usr/bin/env ruby | |
BEGIN { | |
clusters = Hash.new {|h, k| h[k] = []} | |
} | |
ARGF.each_line do |line| | |
case line | |
when /\s*(\w+) -> .+?grey60/ |
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
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<svg class="chart"></svg> | |
<script src="http://d3js.org/d3.v3.min.js"></script> | |
<script> | |
var width = 500, | |
height = 500, | |
scale = 100000, | |
longitude = -122.4167, |