Skip to content

Instantly share code, notes, and snippets.

View viktor-shmigol's full-sized avatar

Viktor Shmigol viktor-shmigol

View GitHub Profile

Resources:

https://github.com/ankane/searchkick

Indexing

By default, simply adding the call 'searchkick' to a model will do an unclever indexing of all fields (but not has_many or belongs_to attributes).

In practice, you'll need to customize what gets indexed. This is done by defining a method on your model called search_data

def search_data

<script type="text/javascript">
drawBadge(number, style) {
var radius = style.radius;
var img = document.createElement('canvas');
img.width = Math.ceil(radius * 2);
img.height = Math.ceil(radius * 2);
img.ctx = img.getContext('2d');
img.radius = radius;
img.number = number;
img.displayStyle = style;
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
docker-compose-prod.yml:
```
version: '2'
services:
web:
build:
context: .
dockerfile: ./Dockerfile_prod
command: /bin/bash -c "envsubst '$$NGINX_HOST $$NGINX_PORT' < /etc/nginx/conf.d/angular-seed.template > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'"
Add the overcommit gem to your Gemfile in the development group,
Run overcommit --install, and
Configure overcommit to run Rubocop before a commit is complete by modifying the .overcommit.yml file. PreCommit: # Ignore all Overcommit default options ALL: enabled: false on_warn: fail
# Enable explicitly each desired pre commit check
RuboCop:
enabled: true
description: 'Analyzing with Rubocop'
required_executable: 'rubocop'
location /cable {
proxy_pass http://puma;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}
import { Http, RequestOptions, ConnectionBackend, RequestOptionsArgs, Response } from '@angular/http'
import { Injectable } from '@angular/core'
import { PromiseTrackerService } from './promise_traker'
import { Observable } from 'rxjs'
import 'rxjs/add/operator/map';
export class HttpLoading extends Http {
constructor(backend: ConnectionBackend, defaultOptions: RequestOptions, private promiseTrackerService: PromiseTrackerService ) {
scope :availables, lambda { |scope_by|
public_send(scope_by) if %w(count).include?(scope_by)
}
['Admin', 'Developer', 'Customer'].forEach((role) => {
Executor.prototype[`is${role}`] = (item)=> {
return item.type === role
}
})
and then data.isAdmin
= select :user, :type, options_for_select(User::TYPES, selected: user.type), {}, data: { remote: true, url: admin_user_path(user.id, type: params[:type]), method: :put }