Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View oivoodoo's full-sized avatar
🏠
Working from home

Alex oivoodoo

🏠
Working from home
View GitHub Profile
@oivoodoo
oivoodoo / required.coffee
Created February 17, 2014 12:46
required.coffee
admin.directive 'gpnRequired', ['$compile', ($compile) ->
isEmpty = (value) ->
angular.isUndefined(value) || value is '' || value is null || (angular.isArray(value) && value.length is 0)
link = ($scope, $element, $attributes, $control) ->
title = I18n.t('js.required')
name = $scope.$eval($attributes.gpnRequried) || $attributes.gpnRequired
template = "<span class = 'error' ng-show = \"form['#{name}'].$error.gpnRequired\">#{title}</span>"
angular.element($compile(template)($scope)).insertAfter($element)
@oivoodoo
oivoodoo / .ctags
Created March 25, 2014 08:50
.ctags
--regex-ruby=/(^|[:;])[ \t]*([A-Z][[:alnum:]_]+) *=/\2/c,class,constant/
--regex-ruby=/(^|;)[ \t]*(has_many|belongs_to|has_one|has_and_belongs_to_many)\(? *:([[:alnum:]_]+)/\3/f,function,association/
--regex-ruby=/(^|;)[ \t]*(named_)?scope\(? *:([[:alnum:]_]+)/\3/f,function,named_scope/
--regex-ruby=/(^|;)[ \t]*expose\(? *:([[:alnum:]_]+)/\2/f,function,exposure/
--regex-ruby=/(^|;)[ \t]*event\(? *:([[:alnum:]_]+)/\2/f,function,aasm_event/
--regex-ruby=/(^|;)[ \t]*event\(? *:([[:alnum:]_]+)/\2!/f,function,aasm_event/
...
grunt.registerTask('heroku:production' , 'build');
};
it 'should work faster using ranges in threads on aggregate' do
Report1 = Class.new do
include Mongoid::Report
report 'example' do
attach_to Model do
group_by :day
column :field1
end
end
{ '$match' => { :campaign_id => { '$exists' => true, '$ne' => nil } } },
module V2
class ReportByCampaign < BaseReport
report 'campaign' do
attach_to DailyEventAd, as: 'ads' do
# We are using columns for resolving dynamic columns on rows
columns COLUMNS
# Fields Mapping is linking columns fields and row fields
mapping AD_FIELDS
app_name: ->(context, row, options) do
return if options.fetch(:summary)
app_id = row[options[:mapping]['app_id']]
return unless context.apps[app_id]
context.apps[app_id].name
end,
report_klass = Class.new do
include Mongoid::Report
report 'example' do
columns :field4 => ->(context, row, options) { row['field3'] }
column :field3, :field4
attach_to 'pregenerated' do
group_by :field1
class Api::Client::V1::Users < Grape::API
resources :users do
RegistrationSteps = [
->(user) { FollowersPopulationService.new(user).create },
->(user) { TimelinesRegistrationService.new(user).create },
]
params do
requires :auth_token, type: String, desc: "Auth token picked up on the user activity on the device"
@oivoodoo
oivoodoo / shell.sh
Created August 18, 2014 09:12
ruby installation
RUBY_CONFIGURE_OPTS=--with-readline-dir="$(brew --prefix readline)" rbenv install 2.1.2