Skip to content

Instantly share code, notes, and snippets.

require:
- rubocop-rails
- rubocop-rspec
- rubocop-factory_bot
AllCops:
Exclude:
- '**/Guardfile'
- 'bin/*'
- 'out/**/*'
module Defaults
extend ActiveSupport::Concern
included do
# Make sure #set_default_values is called after initialize
after_initialize :set_default_values
# Set default values before initialize
def set_default_values
self.class.defaults.each do |attribute, param|
class Widget
# BusinessSearch widget
#
# Attributes:
#
# cache - Total seconds to cache the data from this widget
# type_list - Types of businesses to search
#
# Methods:
#
$scope.lookup = function() {
var path = "api/v1/" + $scope.type + ".json";
var businesses = Restangular.all(path);
var filters = angular.copy($scope.filters);
_.each(filters, function(value, index) {
if (value instanceof Array) {
filters[index + '[]'] = value;
delete filters[index];
}
// Restaurants finder
ink.controller('FinderRestaurantCtrl', ['$scope', 'Restaurant', 'Geocoder', function($scope, Restaurant, Geocoder) {
// Businesses
$scope.businesses = [];
// Filters
$scope.filters = {};
// Search
$scope.lookup = function() {
Factory.define :application do |factory|
factory.attachment(:sample, "public/samples/sample.doc", "application/msword")
end
14:55:23 < anathematic> mark[oz]: I don't believe in work
14:55:34 < anathematic> <3<3<3<3<3<3<3 cucumber
14:55:40 < anathematic> if someone is mastubating about me allow me to help
14:55:58 < mark[oz]> masturbating?
14:56:06 < anathematic> typo++
14:56:11 < mark[oz]> wtf
14:56:13 < mark[oz]> lol
14:56:23 < mrkris> hhahahahhahahahaha
<link rel="canonical" href="http://www.yoursite.com/path/to/article" />
class Admin::PagesController < InheritedResources::Base
actions :all
def update
update! do |success, failure|
failure.html { redirect_to root_url }
end
end
protected
rescue_from ActionController::RoutingError, :with => :page_not_found
private
def page_not_found
activate_authlogic
@possible = Title.find_tagged_with(request.request_uri.split('/'), :on => :tags, :limit => 5)
render :template => "shared/page_not_found", :status => :not_found
end