Skip to content

Instantly share code, notes, and snippets.

@Phazz
Phazz / README.md
Created December 30, 2012 15:39 — forked from dariocravero/README.md

Create a Meteor app and put the client_/server_ files in a client/server directories. Also, create a public dir to save the uploaded files.

# blog post:
# Before using this initializer, you must set up Cancan. First, add the gem to your Gemfile:
#
# gem 'cancan'
#
# Next, generate and edit an Ability class:
#
# rails generate cancan:ability
#
# config/initializers/active_admin.rb
ActiveAdmin.setup do |config|
config.current_user_method = :current_user
config.authentication_method = :authenticate_user!
config.before_filter :admin_role_filter
end
# Adding all recource names to Permissions table after ActiveAdmin is loaded
ActiveAdmin::Dashboards.build do
# Add this section in your dashboard...
section "Background Jobs" do
now = Time.now.getgm
ul do
li do
jobs = Delayed::Job.where('failed_at is not null').count(:id)
link_to "#{jobs} failing jobs", admin_jobs_path(q: {failed_at_is_not_null: true}), style: 'color: red'
end
ActiveAdmin.register_page "Dashboard" do
menu :priority => 1, :label => proc{ I18n.t("active_admin.dashboard") }
content :title => proc{ I18n.t("active_admin.dashboard") } do
# div :class => "blank_slate_container", :id => "dashboard_default_message" do
# span :class => "blank_slate" do
# span "Welcome to Active Admin. This is the default dashboard page."
# small "To add dashboard sections, checkout 'app/admin/dashboards.rb'"
# end

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after
@Phazz
Phazz / gist:5755611
Created June 11, 2013 09:28
AA Chosen
module ActiveAdmin
module Inputs
class FilterSelectInput < ::Formtastic::Inputs::SelectInput
def extra_input_html_options
{
:class => 'chosen'
}
end
end
end
<%= semantic_form_for @parent do |a| %>
<%= a.inputs "Family Details" do %>
<%= a.input :name %>
<%= a.input :user %>
<%= a.input :region %>
<% end %>
<%= a.inputs "Children" do %>
<table>