Skip to content

Instantly share code, notes, and snippets.

View daveshah's full-sized avatar
💭
💻

Dave Shah daveshah

💭
💻
View GitHub Profile
@daveshah
daveshah / form_helpers.ex
Created October 14, 2023 22:25
A simple function to provide US states in select inputs
defmodule FormHelpers do
def us_state_select_options do
[
{"Alabama", "AL"},
{"Alaska", "AK"},
{"American Samoa", "AS"},
{"Arizona", "AZ"},
{"Arkansas", "AR"},
{"California", "CA"},
{"Colorado", "CO"},
@daveshah
daveshah / job-posting.md
Created September 28, 2022 20:04
Job Posting Reflection Exercise

Description

Below is a completely made up and ridiculous job description. Change it.

Make this job description THE job description that, were it presented to you today, would make you apply (or at least consider application) immediately.
Don't limit yourself to any of the headings. If there are headings that you feel are missing and important to you, add them and content to describe them.
Similarly, don't feel like you have to add to every heading. If you feel that some headings are a "given" or you don't feel like adding content under any of the headings - remove them!

In this exercise, feel free to look around!!!

@daveshah
daveshah / env_loader.ex
Created February 11, 2022 14:30
Quick and dirty Elixir .env file loader
defmodule EnvLoader do
def load_env_file!, do: get_env_file() |> set_file_env_vars()
defp set_file_env_vars(nil), do: :ok
defp set_file_env_vars(file_name) do
File.read!(file_name)
|> String.split()
|> Enum.map(fn kvp -> String.split(kvp, "=") |> List.to_tuple() end)
|> System.put_env()
@daveshah
daveshah / docker-guard.sh
Created December 28, 2021 19:13
Quick snippet that halts script execution if docker is not up and running.
#!/usr/bin/env bash
if ! docker info > /dev/null 2>&1; then
echo "This script uses docker, and it isn't running - please start docker and try again!"
exit 1
fi
@daveshah
daveshah / LinkedText.swift
Created September 8, 2021 17:26 — forked from mjm/LinkedText.swift
Tappable links in SwiftUI Text view
import SwiftUI
private let linkDetector = try! NSDataDetector(types: NSTextCheckingResult.CheckingType.link.rawValue)
struct LinkColoredText: View {
enum Component {
case text(String)
case link(String, URL)
}
@daveshah
daveshah / whats-next.md
Created April 28, 2021 15:14
whats-next

Just what is this?

Below is a completely made up and ridiculous job description. Change it! Make this job description THE job description that, were it presented to you today, would make you apply (or at least consider application) immediately. Don't limit yourself to any of the headings. If there are headings that you feel are missing and important to you, add them and content to describe them. Similarly, don't feel like you have to add to every heading. If you feel that some headings are a "given" or you don't feel like adding content under any of the headings - remove them! In this exercise, feel free to look around. Steal from other job descriptions that exist in the wild and take the best parts - those that resonate most with you and would be an aspect of the work you'd like to see yourself doing in the future.

The intent is to make the vision of your next role clearer.

Template:

Time Management is Bullshit.

It's true.

I spent several years of my software career trying to find better ways of managing my time and using it efficiently. I wanted to make sure I was spending the most time on what mattered most.

Lately, I’ve come to realize how flawed this line of thinking is.

It’s not about time. It’s about energy.

@daveshah
daveshah / InlineWheelPickerStyle.swift
Created October 16, 2019 14:26
A quick way to implement WheelPickerStyle similarly to the DatePicker
@State private var options = ["option 1", "option 2", "option 3"]
@State private var selectedOption = 0
@State private var showPicker = false
@State private var date = Date()
var body: some View {
Form {
Button(action: { self.showPicker.toggle() }){
HStack {
@daveshah
daveshah / links.md
Last active June 2, 2017 14:23
Just some thoughts on measuring me to be a better me
@daveshah
daveshah / tmux-cheatsheet.markdown
Created January 31, 2017 15:27 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname