Skip to content

Instantly share code, notes, and snippets.

@foloinfo
foloinfo / generate_migration.sh
Created October 19, 2023 05:42
Prisma rollback shell script
#!/bin/bash
# prisma does not generate rollback (down script by default)
# this script will generate the down script for each migration
name=$1
dir=$(pwd)
if [ -z "$name" ]
then
@lazaronixon
lazaronixon / rubocop.yml
Last active October 21, 2022 17:49
Basecamp Rubocop Template
# This template is inspired on https://github.com/basecamp/audits1984/blob/master/.rubocop.yml
#
# 1 - Add dependencies to group :development, :test
# gem "rubocop", "~> 1.26", require: false
# gem "rubocop-performance", require: false
# gem "rubocop-rails", require: false
#
# 2 - Create a file .rubocop.yml and add the lines below
# inherit_from: https://gist.githubusercontent.com/lazaronixon/7815d84702f277ead5e89c9f2aa5581f/raw/rubocop.yml
#
@tabishiqbal
tabishiqbal / _form.html.erb
Last active May 2, 2024 13:30
Ruby on Rails Tom-Select Example with Stimulus controller
<%= form_with(model: team) do |form| %>
<div>
<%= form.label :name %>
<%= form.text_field :name, class: "input" %>
</div>
<div>
<%= f.select :user_id, {}, {placeholder: "Select user"}, {class: "w-full", data: { controller: "select", select_url_value: users_path }} %>
</div>
@davidtolsma
davidtolsma / rails-docker
Last active November 5, 2023 12:29
This sets up docker for rails with nginx, postgres, redis, sidekiq, and action_cable, # rails 6.1 # ruby 2.7.2 # required gems: pg, redis, sidekiq # requires config/sidekiq.yml config/initializers/sidekiq.rb cable/config.ru
# rails app:template LOCATION='https://gist.github.com/davidtolsma/3af8f8961abe3a635e41776fe2f3af54/raw'
# This sets up docker for rails with nginx, postgres, redis, sidekiq, and action_cable
# rails 6.1
# ruby 2.7.2
# required gems: pg, redis, sidekiq
# requires config/sidekiq.yml config/initializers/sidekiq.rb cable/config.ru
create_file 'docker/nginx/Dockerfile' do <<~YAML
@michaelbragg
michaelbragg / docker-compose.yml
Created July 18, 2020 06:08
Docker | WordPress | Mailhog: Add the ability to send email from WordPress and have it caught in Mailhog.
volumes:
db_data:
version: '3.7'
services:
mysql:
container_name: mysql
image: mysql:5.7
volumes:
@edwardlorilla
edwardlorilla / how-to-select-vuejs-check-all-uncheck-all-checkboxes.markdown
Last active January 17, 2023 14:50
HOW TO SELECT VUEJS CHECK ALL UNCHECK ALL CHECKBOXES
@mrmartineau
mrmartineau / stimulus.md
Last active July 18, 2024 07:43
Stimulus cheatsheet
@javilobo8
javilobo8 / download-file.js
Last active July 1, 2024 23:21
Download files with AJAX (axios)
axios({
url: 'http://localhost:5000/static/example.pdf',
method: 'GET',
responseType: 'blob', // important
}).then((response) => {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'file.pdf');
document.body.appendChild(link);
@harv
harv / glibc-2.17_centos6.sh
Last active July 3, 2024 09:07
update glibc to 2.17 for CentOS 6
#! /bin/sh
# update glibc to 2.17 for CentOS 6
wget http://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/glibc-2.17-55.fc20/glibc-2.17-55.el6.x86_64.rpm
wget http://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/glibc-2.17-55.fc20/glibc-common-2.17-55.el6.x86_64.rpm
wget http://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/glibc-2.17-55.fc20/glibc-devel-2.17-55.el6.x86_64.rpm
wget http://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/glibc-2.17-55.fc20/glibc-headers-2.17-55.el6.x86_64.rpm
sudo rpm -Uvh glibc-2.17-55.el6.x86_64.rpm \
@peterdemartini
peterdemartini / command.sh
Last active May 20, 2024 11:04
Exclude node_modules in timemachine
find `pwd` -type d -maxdepth 3 -name 'node_modules' | xargs -n 1 tmutil addexclusion