Skip to content

Instantly share code, notes, and snippets.

@foloinfo
foloinfo / generate_migration.sh
Last active January 5, 2025 12:31
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 January 15, 2025 21:39
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:
@noahcoad
noahcoad / readme.md
Last active April 18, 2025 21:50
Code Minecraft with Python on Mac OSX

Code Minecraft with Python on Mac OSX

Here's a step-by-step to get started scripting Minecraft with Python on Mac OSX

@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 April 9, 2025 15:37
Stimulus cheatsheet
@javilobo8
javilobo8 / download-file.js
Last active March 17, 2025 14:25
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 February 4, 2025 14:53
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 \