Skip to content

Instantly share code, notes, and snippets.

View alexyakubenko's full-sized avatar

Alexandr Yakubenko alexyakubenko

  • NXTThing RPO
  • Minsk, Belarus
  • 17:44 (UTC -12:00)
View GitHub Profile
- unless Rails.test_or_ci_env?
javascript:
UserVoice=window.UserVoice||[];(function()
{var uv=document.createElement('script');uv.type='text/javascript';uv.async=true;uv.src='//widget.uservoice.com/WRnfQX4xWkCMjsWIpCBYQ.js';var s=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(uv,s)}
)();
UserVoice.push(['set',
{ accent_color: '#448dd6', trigger_color: 'white', trigger_background_color: '#e2753a' }
]);
UserVoice.push(['addTrigger',
{
// Video embed on main page
function load_video() {
function embedVideo(options) {
// Flash
var params = {
allowfullscreen: "true",
allowscriptaccess: "always",
wmode: "opaque"
};
div content-for="leftTopAction"
.btn.btn-navbar.sidebar-toggle ng-click="toggle('mainSidebar')"
= fa_icon "bars"
div content-for="page-title"
span Videos
.videos
.scrollable
.scrollable-content
.panel-group
- content_for :css do
= stylesheet_link_tag 'videos_page'
- content_for :js do
= javascript_include_tag 'videos_page'
- unless current_user.preferences[:video_page_flag]
.dotted-box.row
button.close type="button" ×
.text-box.bigger-box
.header-text
angular.module('swCascadeSelect', [])
.directive 'cascadeSelect', [ ->
multiSelect =
controller: ['$scope', '$element', '$attrs', ($scope, $element, $attrs) ->
$scope.changeValue = (model)->
$scope.cascadeGlobalModel[$scope.cascadeQuestion.destination_name] = model
if model && !model.custom_field
for key, object of $scope.cascadeGlobalModel
unless key == $scope.cascadeQuestion.destination_name
$scope.cascadeGlobalModel[key] = undefined
angular.module('swCascadeMultiSelect', [])
.directive 'cascadeMultiSelect', [ ->
cascadeMultiSelect =
controller: ['$scope', '$element', '$attrs', ($scope, $element, $attrs) ->
$scope.changeValue = (model) ->
$scope.cascadeModel = [] unless $scope.cascadeModel
$scope.cascadeModel.push(model.id)
$scope.tagRemoved = (tag) ->
index = $scope.cascadeModel.indexOf(tag.id)
angular.module('swMultiSelect', [])
.directive 'multiSelect', [ ->
multiSelect =
controller: ['$scope', '$element', '$attrs', ($scope, $element, $attrs) ->
$scope.changeValue = (modelChild)->
$scope.showCountMessage = $scope.msModel.length >= $scope.msMaxTagsCount
return unless modelChild
return if $scope.showCountMessage
index = $scope.msOptions.indexOf(modelChild)
$scope.msOptions.splice(index, 1)
class window.DropBoxPicker
constructor: (buttonContainer, dropBoxKey, callback)->
@options = {
success: callback
linkType: 'direct'
multiselect: false
extensions: ['.pdf', '.doc', '.docx', '.html', '.odt', '.xml', '.epub', '.rtf', '.txt']
}
Dropbox.appKey = dropBoxKey
class window.GoogleDrivePicker
constructor: (apiKey, clientId, buttonEl, callback) ->
@developerKey = apiKey
@clientId = clientId
@pickerApiLoaded = false
@buttonEl = buttonEl
@oauthToken = ''
@mimeTypes = 'application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.google-apps.kix,application/vnd.google-apps.document,text/html,application/vnd.oasis.opendocument.text,application/pdf,application/rtf,text/plain,application/xhtml,application/xml,application/xhtml+xml,application/epub+zip'
@scope = ['https://www.googleapis.com/auth/drive.readonly']

How to calculate multiplier based on CTR-value

During job-import we are going to pre-populate new ctr-priority-multiplier field for each job. Then during job-search we add this field as additional multiplier for calculation of job-score which is performed by ElasticSearch.

All required data is stored inside stats_of_jobs table. (id: integer, job_reference: string, email_sends: integer, email_clicks: integer, created_at: datetime)

Function which calculate ctr_priority_multiplier will looks like this:

MIN_SENDS = 10
MIN_CLICKS_FACTOR_SENDS = 1000