Skip to content

Instantly share code, notes, and snippets.

@kwent
kwent / 20200119064500_add_position_column_to_active_storage_attachments.rb
Last active February 3, 2024 16:25
Rails | Active Storage Attachment + acts_as_list
# db/migrate/20200119064500_add_position_column_to_active_storage_attachments.rb
class AddPositionColumnToActiveStorageAttachments < ActiveRecord::Migration[6.0]
def change
add_column :active_storage_attachments, :position, :integer, default: 0
end
end
@wancw
wancw / 0 - Readme.md
Last active July 4, 2023 09:34
移除 macOS 健保卡元件

檔案說明

  • removeNHIICC.sh : 移除健保卡元件與相關設定,須以 root (sudo) 權限執行。
  • postinstall.sh : 官方「MAC 元件移除安裝檔」的 script 內容(2020)
@nerdcave
nerdcave / environment.js
Last active May 11, 2021 12:27
PurgeCSS config for Rails 5 and Webpacker (along with Tailwind CSS and Vue.js, in this case)
// first run:
// yarn add glob-all purgecss-webpack-plugin --dev
/*
config/webpack/environment.js
PurgeCSS configuration for Rails 5 + Webpacker + Tailwind CSS + Vue.js
Optionally, put this in production.js if you only want this to apply to production.
For example, your app is large and you want to optimize dev compilation speed.
*/
@akexorcist
akexorcist / index.js
Last active November 17, 2022 11:25
Axios post method requesting with x-www-form-urlencoded content type. See https://axios-http.com/docs/urlencoded
const axios = require('axios')
/* ... */
const params = new URLSearchParams()
params.append('name', 'Akexorcist')
params.append('age', '28')
params.append('position', 'Android Developer')
params.append('description', 'birthdate=25-12-1989&favourite=coding%20coding%20and%20coding&company=Nextzy%20Technologies&website=http://www.akexorcist.com/')
params.append('awesome', true)
@ntamvl
ntamvl / cant-install-rmagick-2-13-1-cant-find-magickwand-h.md
Last active February 21, 2024 11:13
[Resolved In Mac OSX Sierra] Can't install RMagick 2.13.1. Can't find MagickWand.h.

[Resolved] Can't install RMagick 2.13.1. Can't find MagickWand.h

In Mac OSX Sierra, to solve the issue, I had to do the following:

Clean:

brew uninstall imagemagick
brew unlink imagemagick

Then install:

@ismyrnow
ismyrnow / mac-clear-icon-cache.sh
Created May 5, 2017 19:28
Clear the icon cache on a Mac when you start seeing generic icons in Finder or the Dock
sudo rm -rfv /Library/Caches/com.apple.iconservices.store; sudo find /private/var/folders/ \( -name com.apple.dock.iconcache -or -name com.apple.iconservices \) -exec rm -rfv {} \; ; sleep 3;sudo touch /Applications/* ; killall Dock; killall Finder

Uninstall brew package and dependencies

Remove package's dependencies (does not remove package):

brew deps [FORMULA] | xargs brew remove --ignore-dependencies

Remove package:

@bennuttall
bennuttall / remotegpio.md
Last active July 8, 2021 18:22
Set up a Pi and host PC for remote GPIO access using gpiozero

Remote GPIO

GPIO Zero allows you to create objects representing GPIO devices. As well as running it on a Raspberry Pi, you can also install GPIO Zero on a PC and create objects referencing GPIO pins on a Pi over the network.

To do this, you'll need to do a few things to get set up:

  1. Enable Remote GPIO on the Pi in the Raspberry Pi Configuration Tool.

  2. Run the pigpio daemon on the Pi:

@antixrist
antixrist / index.js
Last active March 11, 2022 04:54
vue-magnific. Magnific-popup wrapper for Vue.js
const _ = require('lodash');
const $ = require('jquery');
const Vue = require('vue');
require('jquery.magnific-popup');
module.exports = Vue.extend({
template: require('./tpl.html'),
props: {
show: {
type: Boolean,
@bmhatfield
bmhatfield / .profile
Last active March 18, 2024 07:43
Automatic Git commit signing with GPG on OSX
# In order for gpg to find gpg-agent, gpg-agent must be running, and there must be an env
# variable pointing GPG to the gpg-agent socket. This little script, which must be sourced
# in your shell's init script (ie, .bash_profile, .zshrc, whatever), will either start
# gpg-agent or set up the GPG_AGENT_INFO variable if it's already running.
# Add the following to your shell init to set up gpg-agent automatically for every shell
if [ -f ~/.gnupg/.gpg-agent-info ] && [ -n "$(pgrep gpg-agent)" ]; then
source ~/.gnupg/.gpg-agent-info
export GPG_AGENT_INFO
else