Skip to content

Instantly share code, notes, and snippets.

Phil Smy philsmy

Block or report user

Report or block philsmy

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@philsmy
philsmy / homebrew_mysql_57.md
Created Jul 9, 2018
How to get homebrew to install and use mysql 5.7 instead of 8 under OSX
View homebrew_mysql_57.md

Find older mysql versions

brew search mysql

Install 5.7

brew install mysql@5.7

Link it

brew link mysql@5.7 --force --overwrite

mysql2 gem

@philsmy
philsmy / activejob_delayedjob
Created Oct 15, 2017
configuring ActiveJob and DelayedJob to have priority
View activejob_delayedjob
# app/jobs/sample_job.rb
class SampleJob < ActiveJob::Base
queue_as :maintenance
attr_accessor :options
def enqueue(options = {})
self.options = options
super
end
View notworking_nginx_2_domains.conf
server {
listen 80;
server_name domain1.ca;
return 301 https://www.domain1.com$request_uri;
}
server {
listen 80;
server_name domain1.com;
return 301 https://www.domain1.com$request_uri;
@philsmy
philsmy / gmaps4rails_compare
Created Dec 11, 2013
Comparison of old and new calls to gmaps4rails (Google Maps For Rails - https://github.com/apneadiving/Google-Maps-for-Rails)
View gmaps4rails_compare
## gmaps4rails v1
## controller
@json = @shops.to_gmaps4rails do |shop, marker|
marker.infowindow render_to_string(partial: "/shops/map_info_window", locals: { object: shop})
icon_name = "wl_sm_icon"
unless shop.shop_group.nil?
if (shop.shop_group.name.downcase =~ /pen/) != nil
@philsmy
philsmy / make.log
Created Sep 9, 2011
error from rvm install attempt of ruby 1.8.7
View make.log
[2011-09-09 12:59:08] make
/usr/bin/gcc-4.2 -arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp -fno-common -pipe -fno-common -DRUBY_EXPORT -I. -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -c array.c
/usr/bin/gcc-4.2 -arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp -fno-common -pipe -fno-common -DRUBY_EXPORT -I. -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -c bignum.c
bignum.c: In function ‘rb_big_unpack’:
bignum.c:314: warning: right shift count >= width of type
/usr/bin/gcc-4.2 -arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp -fno-common -pipe -fno-common -DRUBY_EXPORT -I. -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -c class.c
/usr/bin/gcc-4.2 -arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp -fno-common -pipe -fno-common -DRUBY_EXPORT -I. -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -c compar.c
/usr/bin/gcc-4.2 -arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp -fno-common -pipe -fno-common -DRUBY_EXPORT -I. -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -c dir.c
/usr/bin/gcc-4.2 -a
@philsmy
philsmy / ability.rb
Created Aug 23, 2011
our ability class
View ability.rb
class Ability
include CanCan::Ability
def initialize(user)
user ||= User.new # guest user
if user.role? :super_admin
can :manage, :all
else
@philsmy
philsmy / arel_or.rb
Created Aug 18, 2011
or scopes - add this to your model to be able to or scopes together (eg: Model.or(Model.scope1, Model.scope2). Stolen and adapted from fake_arel
View arel_or.rb
__or_fn = lambda do |*scopes|
where = []
joins = []
includes = []
# for some reason, flatten is actually executing the scope
scopes = scopes[0] if scopes.size == 1
scopes.each do |s|
w = []
s.where_clauses.each do |where_clause|
View install_rmagick_osx.sh
#!/bin/sh
mkdir -p ~/development/src
cd ~/development/src
if [ -d ImageMagickInstall ]
then
# remove old ImageMagickInstall directory if it exists
rm -rf ImageMagickInstall
fi
mkdir ImageMagickInstall
cd ImageMagickInstall
You can’t perform that action at this time.