Skip to content

Instantly share code, notes, and snippets.

View marcdel's full-sized avatar

Marc Delagrammatikas marcdel

View GitHub Profile
@marcdel
marcdel / feedback.md
Last active April 17, 2024 18:45
Zed Feedback

Feature Requests

  • Tab behavior: I want to be able to tab between most recently used tabs (panes?)
  • Split behavior: there’s a jump left/right but I want one keybind to go back and forth
  • Pane: jump to test file and back
  • Folds: I want to be able to fold all levels and unfold one level at a time
  • Folds: I want to be able to fold/unfold recursively one function (section?) at a time
  • Tasks: must be able to inherit the environment from the shell session from which it was launched
  • Terminal: shared terminal is a must. Having to jump (visually or cmd-tab) between screen sharing and the editor is frustrating, especially while TDDing
  • Multi-select: need a cmd-g equivalent to go with ctrl-g
  • Multi-select: column selection mode key bind (opt-opt-up/down in IntelliJ)
@marcdel
marcdel / thing.ex
Created November 1, 2023 18:23
assign_async with error
{:noreply,
socket
|> assign_async(:the_data, fn ->
case do_work() do
{:ok, the_data} -> {:ok, the_data}
:error -> {:error, "Whoops!"}
end
end)}
# Telegraf Configuration
# Configuration for telegraf agent
[agent]
## Default data collection interval for all inputs
interval = "10s"
## Rounds collection interval to 'interval'
## ie, if interval="10s" then always collect on :00, :10, :20, etc.
round_interval = true
@marcdel
marcdel / multi_task.ex
Created March 12, 2020 23:13
Easily run a list of functions concurrently
def multi_task(functions) do
functions
|> Task.async_stream(fn function -> function.() end)
|> Enum.map(fn {:ok, result} -> result end)
end
@marcdel
marcdel / flocking.md
Created June 6, 2019 18:14
Notes about the flocking refactoring strategy from 99 Bottles of OOP

Flocking

Rules

  1. Select the things that are most alike.
  2. Find the smallest difference between them.
  3. Make the simplest change that will remove that difference.

Steps

  1. Parse the new code. (e.g. else clause based on a boolean that is always false)
  2. Parse and execute the new code. (e.g. else clause based on a boolean that is passed in as a parameter)
@marcdel
marcdel / ugh.ex
Last active February 25, 2017 07:46
def add(new_item) do
Agent.update __MODULE__, fn items ->
items
|> add_or_merge_item(new_item)
end
end
def add_or_merge_item(items, new_item) do
if item_exists(items, new_item) do
merge_item(items, new_item)

Keybase proof

I hereby claim:

  • I am marcdel on github.
  • I am marcdel (https://keybase.io/marcdel) on keybase.
  • I have a public key ASCfUn6t0rq65lUDCV2fMv63BNb70KdX9lHRaw_yHjFvcgo

To claim this, I am signing this object:

@marcdel
marcdel / diy-mock.rb
Created March 3, 2014 05:26
From Aaron Patterson's PeepCode Play By Play
class Clienttest < MiniTest::Unit::TestCase
def test_marcdel
sample_data = File.read 'test/assets/marcdel.json'
tc = self
# Redefine private get method to use sample data instead of doing http get
klass = Class.new(Client) do
define_method(:get) do |username|
tc.assert_equal 'marcdel', username
set = []
array.each do |item|
set.push item
if item % 4 == 0
puts set.inspect
set = []
end
end
Creating Sessions
tmux new - new unnamed session
tmux new -s session_name - new named session
tmux new -s session_name -n window_name - new named session with named window
tmux ls - list all running sessions
tmux attach -t session_name - reattaches to named session
tmux kill-session -t session_name - kills a named session
Ctrl+a d - detaches from current session
Ctrl+a : - command mode