Simple Dashing job to display total number of events in MixPanel .
##Preview
##Dependencies
| # put this under **#{Rails.root}/config/initializers** directory | |
| # `silence` is like Chuck Norris you can't kill it, this biuty got yet again | |
| # re-invented in Rails 4 right after Logger#silence got deprecated in 3.2 :) | |
| begin | |
| require 'active_support/logger' | |
| require 'active_support/logger_silence' | |
| ActiveSupport::Logger.silencer = false # silence simply yields | |
| # if 'active_support/core_ext/logger' is loaded |
| class AssignCaseCommand < Command | |
| attribute :case, Case | |
| attribute :owner, User | |
| attribute :created_by, User | |
| attribute :comments, String | |
| attribute :distribute_at, DateTime | |
| attribute :distribute_rule_name, String | |
| attribute :require_initial, Boolean |
| class GroupersController < ApplicationController::Base | |
| def create | |
| @grouper = Grouper.new(leader: current_member) | |
| if @grouper.save | |
| ConfirmedGrouperEmails.new(@grouper).deliver | |
| AssignBarForGrouper.enqueue(@grouper.id) | |
| redirect_to home_path | |
| else |
| class GroupersController < ApplicationController::Base | |
| def create | |
| @grouper = Grouper.new(leader: current_member) | |
| if @grouper.save | |
| confirm_grouper_via_emails(@grouper) | |
| enqueue_bar_assignment(@grouper) | |
| redirect_to home_path | |
| else |
| #!/usr/bin/env ruby | |
| require 'openssl' | |
| data = File.open('blob', 'r:ASCII-8BIT').read | |
| c = OpenSSL::Cipher.new('AES-128-ECB') | |
| c.decrypt | |
| c.key = 'M02cnQ51Ji97vwT4' | |
| o = ''.force_encoding('ASCII-8BIT') | |
| data.bytes.each_slice(16) { |s| o += c.update(s.map(&:chr).join) } |
| @media (min-width:320px) { /* smartphones, portrait iPhone, portrait 480x320 phones (Android) */ } | |
| @media (min-width:480px) { /* smartphones, Android phones, landscape iPhone */ } | |
| @media (min-width:600px) { /* portrait tablets, portrait iPad, e-readers (Nook/Kindle), landscape 800x480 phones (Android) */ } | |
| @media (min-width:801px) { /* tablet, landscape iPad, lo-res laptops ands desktops */ } | |
| @media (min-width:1025px) { /* big landscape tablets, laptops, and desktops */ } | |
| @media (min-width:1281px) { /* hi-res laptops and desktops */ } |
| filter :reception_reception_date, as: :date_range, label: Reception.human_attribute_name(:reception_date_full) | |
| collection_action :download_report, :method => :get do | |
| services = Service.includes(:order, reception: [{medic: :clinic_medics}]).where{ orders.orderable_id != nil } # necessary model | |
| if params[:q] && params[:q][:reception_reception_date_gte].length > 1 | |
| services = services.where("receptions.reception_date >= ?", params[:q][:reception_reception_date_gte]) | |
| end | |
| if params[:q] && params[:q][:reception_reception_date_lte].length > 1 | |
| services = services.where("receptions.reception_date < ?", params[:q][:reception_reception_date_lte]) | |
| end |
| ##Userable | |
| module Userable | |
| def self.included(base) | |
| base.has_one :user, :as => :userable, :dependent => :destroy, :autosave => true | |
| base.validate :user_must_be_valid | |
| base.alias_method_chain :user, :autobuild | |
| base.extend ClassMethods | |
| base.define_user_accessors | |
| end | |
| Copyright (c) 2010-2015 Giulia Alfonsi <[email protected]> | |
| Permission is hereby granted, free of charge, to any person | |
| obtaining a copy of this software and associated documentation | |
| files (the "Software"), to deal in the Software without | |
| restriction, including without limitation the rights to use, | |
| copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| copies of the Software, and to permit persons to whom the | |
| Software is furnished to do so, subject to the following | |
| conditions: |