Skip to content

Instantly share code, notes, and snippets.

View RyanMacG's full-sized avatar
🏴󠁧󠁢󠁳󠁣󠁴󠁿

Ryan MacGillivray RyanMacG

🏴󠁧󠁢󠁳󠁣󠁴󠁿
View GitHub Profile
@RyanMacG
RyanMacG / application_helper.rb
Created December 12, 2012 15:18
Full_title Helper
#Returns full title on a per-page basis
def full_title(page_title)
base_title = "JTCscDB"
if page_title.empty?
base_title
else
"#{base_title} | #{page_title}"
end
end
@RyanMacG
RyanMacG / .gitignore
Created December 17, 2012 14:08
basic .gitignore for rails projects
# Ignore bundler config
/.bundle
# Ignore the default SQLite database.
/db/*.sqlite3
# Ignore all logfiles and tempfiles.
/log/*.log
/tmp
@RyanMacG
RyanMacG / bootstrap_paginate
Created February 12, 2013 16:05
Make will paginate play nice with bootstrap
if defined?(WillPaginate)
module WillPaginate
module ActionView
def will_paginate(collection = nil, options = {})
options[:renderer] ||= BootstrapLinkRenderer
super.try :html_safe
end
class BootstrapLinkRenderer < LinkRenderer
protected
@RyanMacG
RyanMacG / assets_controller.rb
Created March 12, 2013 11:55
Add a new asset
def create
@asset = current_user.assets.build(params[:asset])
if @asset.save
redirect_to root_path
flash.now[:success] = "Asset created!"
else
render 'static_pages/home'
end
end
@RyanMacG
RyanMacG / Gemfile
Created June 20, 2013 12:43
A rake task to convert erb views to haml
source 'http://rubygems.org'
#Gems that are required in any environment, by defining the version of the gem we want to use
#we don't have to worry about updates causing unexpected issues.
gem 'rails', '3.2.13'
gem 'bootstrap-sass', '2.2.1.1'
gem 'bcrypt-ruby', '3.0.1'
gem 'jquery-rails', '>= 2.0.0'
gem 'faker', '1.0.1'
gem 'will_paginate', "3.0.3"
@RyanMacG
RyanMacG / Storify embed generator
Last active December 23, 2015 08:39
Find storify link and build embed
$('#ugc a[href*="storify.com"]').each(function(){
$(this).replaceWith('<div class="storify"><iframe src='+this+'/embed width="'+video_width+'" height="750" frameborder=no allowtransparency=true</iframe><script src='+this+'.js"></script><noscript>[<a href='+this+' target="_blank">View the story on Storify</a>]</div></noscript>');
});
user www-data;
worker_processes 4;
pid /var/run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
@RyanMacG
RyanMacG / bgg_example.rb
Last active January 2, 2016 12:59
Example usage of bgg-api for getting an array of game names from a user's boardgamegeek collection
class ExampleBggApiUsage
require 'pry-debugger'
require 'bgg-api'
bgg = BggApi.new
puts "What user's collection do you want to find?"
username = gets
username = username.chomp
collection = bgg.collection({username: username})
/* hover overrides */
a {
&:hover {
text-decoration: none;
}
}
.nav {
li {
@RyanMacG
RyanMacG / keybase.md
Created April 12, 2014 19:03
keybase verification

Keybase proof

I hereby claim:

  • I am ryanmacg on github.
  • I am ryn (https://keybase.io/ryn) on keybase.
  • I have a public key whose fingerprint is 4452 3A42 1E57 FE3C E0CA 2FF3 2328 9D84 EBF5 DA37

To claim this, I am signing this object: