This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'http://rubygems.org' | |
gem 'rails', '3.1.1' | |
# Bundle edge Rails instead: | |
# gem 'rails', :git => 'git://github.com/rails/rails.git' | |
gem 'pg' | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* jQuery.UI.iPad plugin | |
* Copyright (c) 2010 Stephen von Takach | |
* licensed under MIT. | |
* Date: 27/8/2010 | |
* | |
* Project Home: | |
* http://code.google.com/p/jquery-ui-for-ipad-and-iphone/ | |
* | |
* Modified: 19/01/2012 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
description "Delayed Job Server" | |
author "Brendon Muir" | |
setuid www-data | |
setgid www-data | |
start on started mysql | |
stop on stopping mysql | |
respawn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Here's a super bare-bones and unstructured implementation of google fonts for the Froala Editor. | |
// | |
// The required dependency is Semantic-UI/dist/components/visibility.js in order to lazy-load google font previews | |
$(document).ready(function() { | |
var $editor_selector = $('.froala-editor'); | |
if ($editor_selector.length) { | |
var options = { | |
fontFamilySelection: true, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
➜ ranked-model git:(master) RUBYOPT=-d bundle exec appraisal rails-5-2 rake | |
Exception: `NoMethodError' core/type.rb:154 - undefined method `to_str' on for_lockfile:Symbol. | |
Exception: `TypeError' core/type.rb:156 - Coercion error: :for_lockfile.to_str => String failed | |
Exception: `NoMethodError' core/type.rb:195 - undefined method `to_ary' on an instance of String. | |
Exception: `NoMethodError' core/type.rb:195 - undefined method `to_ary' on an instance of String. | |
Exception: `NoMethodError' core/type.rb:154 - undefined method `to_str' on to_spec:Symbol. | |
Exception: `TypeError' core/type.rb:156 - Coercion error: :to_spec.to_str => String failed | |
Exception: `LoadError' core/code_loader.rb:303 - no such file to load -- rubygems/defaults/operating_system | |
Exception: `NoMethodError' core/type.rb:195 - undefined method `to_ary' on an instance of String. | |
Exception: `NoMethodError' core/type.rb:195 - undefined method `to_ary' on an instance of String. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
████████╗██╗ ██╗███████╗███╗ ███╗███████╗███████╗ | |
╚══██╔══╝██║ ██║██╔════╝████╗ ████║██╔════╝██╔════╝ | |
██║ ███████║█████╗ ██╔████╔██║█████╗ ███████╗ | |
██║ ██╔══██║██╔══╝ ██║╚██╔╝██║██╔══╝ ╚════██║ | |
██║ ██║ ██║███████╗██║ ╚═╝ ██║███████╗███████║ | |
╚═╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚══════╝╚══════╝ | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
require "bundler/inline" | |
# This reproduction script allows you to test Action Policy with Rails. | |
# It contains: | |
# - Headless User model | |
# - UserPolicy | |
# - UsersController | |
# - Example tests for the controller. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# To run this just install Ruby (it's already on Macs), download this file | |
# into a folder, open your terminal and `cd` into that folder type: | |
# `ruby is_geoff_right.rb` | |
cars = 0 | |
goats = 0 | |
1000000.times do | |
doors = [:car, :goat, :goat] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// You need to add these two configuration options when initialising froala: | |
googleFonts: true, | |
googleFontsAddress: `https://${ASSETS_ADDRESS}/webfonts/detailed` | |
// The address can be anything but the expected structure is fixed and you should be able to infer that from | |
// the font_family.js. I've included the controller I use to generate the cached copy of the webfonts list. | |
// Don't be tempted to hit google all the time with your key as you'll soon reach your fair use limit. | |
// When rendering the page, add data-controller="froala--webfonts" to the surrounding tag (if using my stimulus controller) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# An example migration to add your position column to an existing table | |
class AddPositionToThings < ActiveRecord::Migration[6.1] | |
def change | |
add_column :things, :position, :integer, null: false | |
ParentThing.all.each do |parent_thing| | |
parent_thing.things.order(:updated_at).each.with_index(1) do |thing, index| | |
thing.update_column :position, index | |
end |