Skip to content

Instantly share code, notes, and snippets.

View nplusp's full-sized avatar
🌸

Mikita Pridorozhko nplusp

🌸
View GitHub Profile
@nplusp
nplusp / gist:5c2a579f14283063743d0b8701171d3f
Created April 12, 2019 12:45
fix mysql max index length of 767
ALTER DATABASE dbname CHARACTER SET utf8 COLLATE utf8_general_ci;

Keybase proof

I hereby claim:

  • I am nplusp on github.
  • I am nplusp (https://keybase.io/nplusp) on keybase.
  • I have a public key whose fingerprint is 15FB 8132 60B8 3D73 44BC B9CF 5869 568A B841 34B0

To claim this, I am signing this object:

@nplusp
nplusp / gist:5f55595ef9bb309bafb603a41bda0094
Created June 10, 2019 13:56
Install PG gem without locally installed Postgres
brew install libpq
gem install pg -- --with-opt-dir="/usr/local/opt/libpq"
bundle config --local build.pg --with-opt-dir="/usr/local/opt/libpq"
bundle install
@nplusp
nplusp / git-tag-delete-local-and-remote.sh
Created July 24, 2019 18:36 — forked from mobilemind/git-tag-delete-local-and-remote.sh
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName

How to deploy a Rails 7.1 app with Postgres and Kamal on a single server

I think you have looked at the tutorial from Mr. Heinemeier Hansson at least once or twice and have a similar setup.

rails new kamal_pg --css tailwind --skip-test --database=postgresql

cd kamal_pg
@nplusp
nplusp / application.rb
Created June 6, 2024 11:56 — forked from fractaledmind/application.rb
Create a simple, beautiful Rails-integrated multi-file input that behaves like: https://codepen.io/smargh/pen/mdGLpEz. Uses TailwindCSS, StimulusJS, and ActiveStorage.
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 7.0
# ensure that `update(files: [uploaded_file])` will append, not replace
config.active_storage.replace_on_assign_to_many = false
end
@nplusp
nplusp / gist:e665cadec807f3bfcd88b5a75b1df1b8
Created June 10, 2024 09:03
Create gifs from video in terminal
// install dependencies
brew install ffmpeg
brew install gifsicle
// add alias
alias gify='function _gify(){ ffmpeg -i "$1" -pix_fmt rgb8 -r 10 /tmp/{1%.*}_tmp.gif && gifsicle -O3 /tmp/{1%.*}_tmp.gif -o "${1%.*}.gif"; rm /tmp/{1%.*}_tmp.gif; unset -f _gify; }; _gify'
// run it
gify /path/to/file.mp4