Skip to content

Instantly share code, notes, and snippets.

# Nushell Environment Config File
def create_left_prompt [] {
let $prompt = ([
(ansi green),
(whoami | str trim),
(ansi blue),
'@',
(ansi cyan),
(hostname | str trim),

Drag and Drop Form

This feature should be available on all pages that have to do with an order (has the nav bar at the bottom)

  • on dragging a file to the browser a user should see a modal to say you can drop files.
  • on file drop a user should see:
    • a checkbox to notify closing team
    • a disabled input with file name
    • a select input with a list of document types
    • a text area for a comment with the document
    • a button to remove file
  • a button to close modal
@zachjamesgreen
zachjamesgreen / DeployToTravisAndHeroku.md
Created July 16, 2021 16:20
Notes for deploying a rails api to travis and heroku

Deploy new rails API app with TravisCI and Heroku

ruby version: 2.7.2 | rail version: 5.2.6

Create new rails app

  1. rails new <APP_NAME> -T -d postgresql --api
  2. rails db:create

Create a controller

@zachjamesgreen
zachjamesgreen / music_organizer.go
Created July 6, 2021 05:16
Script to organize music based on the embedded tags
package main
import (
"fmt"
"io"
"io/ioutil"
"log"
"os"
"path/filepath"
"strings"
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.zshrc
source ~/.bashrc
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zshrc
@zachjamesgreen
zachjamesgreen / PSQL_and_or_RUBY_snippets.md
Last active March 31, 2016 16:02
Snippets of ruby code for psql and also psql snippets ive found

#STUFF

Query array of hstore

select * from TABLE where TERM = ALL (SELECT unnest(COLUMN)->HSTORE_KEY);

Add scope using array of hstore

scope :where_any, ->(key, value) { where("? = ANY (SELECT unnest(\"items\") -> ?)", value, key) }
scope :where_all, ->(key, value) { where("? = ALL (SELECT unnest(\"items\") -> ?)", value, key) }
# https://minhajuddin.com/2016/03/03/put-this-in-your-code-to-debug-anything
require 'rouge'
require 'method_source'
require 'pp'
class Dbg
def initialize(object, to:)
@object, @stream = object, to
end
@zachjamesgreen
zachjamesgreen / random_ruby
Created March 2, 2016 19:11
Ruby script to create random string for passwords
#!/usr/bin/env ruby
require "awesome_print"
if ARGV.empty? || ARGV[0] == '' || ARGV[0].empty?
length = 10
else
length = ARGV[0].to_i
end
ap "Generating random string of length #{length}"
r = ('a'..'z').to_a + ('A'..'Z').to_a + ('0'..'9').to_a + %w(! @ # { $ % ^ & * ? < > })

#Code tidbits have found or come up with. Just need a place to keep them.

Remove all docker images that are not tagged

docker rmi --force $(docker images | grep "^<none>" | awk '{ print $3 }')

Remove all images

docker rmi --force $(docker images -q)

Remove all containers

docker rm --force $(docker ps -a -q)