Skip to content

Instantly share code, notes, and snippets.

class FinOperation < ActiveRecord::Base
acts_as_tenant
include FinOperableConcern
MAIN_TYPES = ['CreditFinOperation', 'DebitFinOperation', 'MoveFinOperation', 'DeliveryPayFinOperation']
default_scope { order 'operation_date DESC, id DESC' }
scope :reverse_order, -> { reorder 'operation_date ASC, id ASC' }
scope :accepted, -> { where(accepted: true) }
scope :unaccepted, -> { where(accepted: false) }
angular.module('baton.controllers', [])
.controller('EditActiveList', function( $scope, storage, $element, $rootScope ) {
$scope.isEdit = false;
$scope.list = null;
$scope.init = function( list ) {
$scope.list = list;
if($scope.list){
$scope.list.last_name = $scope.list.name;
}
Map.prototype.generateMap = function(cities_settings) {
this.terrain = new Agency9.Layer.A3XTerrainLayer("terrain", cities_settings.terrain);
this.terrain.setFocusOnTerrain(false);
this.instance.addLayer(this.terrain);
this.buildings_layer_geometry_style = new Agency9.Model.GeometryStyle();
this.buildings_layer_model_style = new Agency9.Style.ModelStyle();
this.buildings_layer_model_style.setGeometryStyle(this.buildings_layer_geometry_style);
this.buildings_layer = new Agency9.Layer.CachedFeatureLayer("buildings", cities_settings.buildings_urls);
require 'rails_helper'
describe Admin::Employees::CheckinsController do
login_admin
before(:all) do
@tenant = create(:tenant)
Tenant.set_current_tenant(@tenant)
end
def check_and_update_kitcheners
if params.has_key?(:restaurant_shop)
related_properties_params = Array.new
params[:restaurant_shop].each do |restaurant_shop_id, person_ids|
person_ids.each do |person_id|
kitchener_obj = {person_id: person_id, restaurant_shop_id: restaurant_shop_id}
related_properties_params.push kitchener_obj
end
end
[
{\"id\":\"368\",\"amount\":\"10000\",\"fin_account_id\":\"60\",\"balance\":\"10000\"},
{\"id\":\"370\",\"amount\":\"-5000\",\"fin_account_id\":\"60\",\"balance\":\"5000\"},
{\"id\":\"372\",\"amount\":\"-4000\",\"fin_account_id\":\"60\",\"balance\":\"1000\"},
{\"id\":\"371\",\"amount\":\"5000\",\"fin_account_id\":\"59\",\"balance\":\"6000\"},
{\"id\":\"373\",\"amount\":\"4000\",\"fin_account_id\":\"59\",\"balance\":\"10000\"}
]
@oleglukashev
oleglukashev / gist:e1d8f815b4fa36ac0d36
Created April 28, 2015 09:33
Тесты, пример
require 'spec_helper'
describe CategoriesController do
let!(:category) { create :category }
let!(:not_published_product) { create :product, category: category }
let!(:product) { create :published_product, category: category, published_at: Time.current - 1.month }
let!(:new_selected_product) { create :published_product, category: category, selection: create(:selection) }
let!(:new_product) { create :published_product, category: category, published_without_selection: true }
context "without current_user" do
$ ->
if window.location.hash.indexOf("open_auth") > -1
$(window).on 'load', () ->
$('.tours-header__menu-item__auth a,header__menu-item__auth a').click()
$('.tours-popular__list-item a').on "click", (e) ->
e.preventDefault()
index = $(@).parent().data("index")
@oleglukashev
oleglukashev / gist:12561465c1d425f46e94
Created April 26, 2015 15:12
Пример верстки. Блоки небольшие т.к. разбиваются все на мелкие логические подблоки
.tour-organizator
.tour-organizator__avatar
= image_tag @tour.guide.avatar.thumb
.tour-organizator__agent-name= @tour.guide.name
.tour-organizator__post Организатор экскурсии
= render partial: 'tour_question'
module SendAnalyticsEvents
extend ActiveSupport::Concern
def send_registration_event
registration_event = MixpanelService.new({
user_id: self.id
}).registration
end
def send_make_guide_event