Skip to content

Instantly share code, notes, and snippets.

View FunnyQ's full-sized avatar

FunnyQ FunnyQ

View GitHub Profile
@FunnyQ
FunnyQ / Gemfile
Created June 25, 2020 07:56 — forked from dhh/Gemfile
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers

Force RGB mode in Mac OS X to fix the picture quality of an external monitor (Original)

Update: I have heard that 10.8.3 has solved this problem for some people, so I rolled back my changes and installed the update. No change on my monitor. Nevertheless, it’d be a good idea to update OS X before trying this, since it may fix the issues with your particular hardware.

I recently bought a MacBook Pro (with ‘Retina’ screen), but when I hooked it up to my Dell U2410 monitor via HDMI cable I was shocked by the poor picture quality. The contrast was all wrong and text was misshapen. No amount of calibration in the monitor or software would fix it.

Short answer: OS X thinks my monitor is a TV, and is using the YCbCr colour space rather than RGB. I had to override an EDID setting to force the RGB colour space, and it is now working correctly.

Long answer: I haven’t owned a Mac for a while and h

@FunnyQ
FunnyQ / mac-clear-icon-cache.sh
Created October 20, 2018 12:19 — forked from ismyrnow/mac-clear-icon-cache.sh
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
@FunnyQ
FunnyQ / README.md
Created May 10, 2018 07:31 — forked from tristanm/README.md
Migrating a Rails project from MySQL to PostgreSQL

Migrating a Rails project from MySQL to PostgreSQL

This brief guide is written from my own experience with migrating a large (~5GB) MySQL database to PostgreSQL for a Rails project.

No warranties, guarantees, support etc. Use at your own risk and, as always, ENSURE YOU MAKE BACKUPS FIRST!

I chose [pgloader][1] because it's extremely fast. YMMV.

  1. Replace mysql2 gem with pg in Gemfile.
  2. Update config/database.yml for PostgreSQL. I used [Rails' template][2] as a starting point.
@FunnyQ
FunnyQ / rails_cache_enabled.sh
Created April 3, 2018 04:29
Rails development caching indicator for zsh with POWERLEVEL9K
# define a function that checking `caching-dev.txt` exists in tmp/
rails_cache_enabled(){
if [[ -e tmp/caching-dev.txt ]]; then
echo -n "\ue00a Caching "
fi
}
# create a custom prompt theme element
POWERLEVEL9K_CUSTOM_RAILS_CACHE_ENABLED="rails_cache_enabled"
POWERLEVEL9K_CUSTOM_RAILS_CACHE_ENABLED_BACKGROUND=154
class Registration < ActiveRecord::Base
scope :nhb_consent_eq, -> (enum = "yes") {
where("document @> ?", { nhb_consent: { value: enum } }.to_json )
}
private
def self.ransackable_scopes(auth_object = nil)
%i(nhb_consent_eq)
end

Keybase proof

I hereby claim:

  • I am funnyq on github.
  • I am funnyq (https://keybase.io/funnyq) on keybase.
  • I have a public key ASCP2k4iHuVVVAU8Te02fbZAulPBh8W0v1jUhvFkbuNs5wo

To claim this, I am signing this object:

#!/usr/bin/ruby
# Create display override file to force Mac OS X to use RGB mode for Display
# see http://embdev.net/topic/284710
require 'base64'
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay`
edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten
vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten