Skip to content

Instantly share code, notes, and snippets.

View tbilous's full-sized avatar

Taras Bilous tbilous

  • Varna, Bulgaria
View GitHub Profile
@tbilous
tbilous / lenovo_ideapad_330_ubuntu.md
Created March 1, 2019 21:37 — forked from debojyoti/lenovo_ideapad_330_ubuntu.md
Lenovo ideapad 330 (15ARR) ubuntu issues and there solutions

Lenovo ideapad 330 (15ARR) ubuntu issues and their solutions

Issue-1: None of the ubuntu distros are getting installed

Solution: Ubuntu distros lower than 18.10 will not work in this laptop, as minimum kernal version required is 4.18.

So install ubuntu 18.10 / xubuntu 18.10 / lubuntu 18.10 / kubuntu 18.10 in UEFI mode

Issue-2: Wifi is not working

@tbilous
tbilous / gist:e3611662dbb757819e1b188f3f783121
Created February 6, 2019 18:38 — forked from webdev1001/gist:e848abef8064c55c2f6443a282f75651
Array values in the parameter to `Gem.paths=` are deprecated.
Array values in the parameter to `Gem.paths=` are deprecated.
Please use a String or nil.
An Array (...) was passed in from bin/rails:3:in `load'
Solution
========
https://github.com/rubygems/rubygems/issues/1551
If you came to this issue by googling the error specified in the description of this issue, you should know that it has already been fixed in spring-1.6.4 and all you need to do is to update to latest spring and regenerate binstubs, like this:
OM "public"."tenants" WHERE "public"."tenants"."name" = $1 LIMIT $2 [["name", "demo"], ["LIMIT", 1]]
Rendered contracts/partials/_export_xlsx_checkbox.html.slim (0.1ms)
DocumentVersion Load (0.5ms) SELECT "document_versions".* FROM "document_versions" WHERE "document_versions"."versionable_id" = $1 AND "document_versions"."versionable_type" = $2 AND "document_versions"."version" = $3 [["versionable_id", 197], ["versionable_type", "Contract"], ["version", 2]]
CACHE (0.0ms) SELECT "attachments".* FROM "attachments" WHERE "attachments"."id" = 3
DigiSigner Load (0.4ms) SELECT "digi_signers".* FROM "digi_signers" WHERE "digi_signers"."document_version_id" = 497
Contract Load (0.2ms) SELECT "contracts".* FROM "contracts" WHERE "contracts"."id" = $1 LIMIT $2 [["id", 197], ["LIMIT", 1]]
CACHE (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 16], ["LIMIT", 1]]
CACHE (0.0ms) SELECT "public"."tenants".* FROM "public"."tenants" WHERE "public"."tenants"."name" = $1
class DeviseTokenAuthCreateUsers < ActiveRecord::Migration[5.1]
def change
create_table(:users) do |t|
## Required
t.string :provider, :null => false, :default => "email"
t.string :uid, :null => false, :default => ""
## Database authenticatable
t.string :encrypted_password, :null => false, :default => ""
require "#{Rails.root}/lib/paypal_service"
class User < ActiveRecord::Base
# Include default devise modules.
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable, :omniauthable
include DeviseTokenAuth::Concerns::User
attr_accessor :skip_callbacks, :social_login, :paypal_token, :payment_type
module Devise
module Strategies
class JWT < Base
def valid?
request.headers['Authorization'].present?
end
def authenticate!
payload = JwtService.decode(token: token)
success! User.find(payload['sub'])
class JwtService
def self.encode(payload:)
JWT.encode(payload, secret)
end
def self.decode(token:)
JWT.decode(token, secret).first
end
def self.secret
module Multisite
extend ActiveSupport::Concern
included do
layout :resolve_layout
before_action :prepend_view_paths
end
private
require 'rails_helper'
RSpec.describe WelcomeController, type: :controller do
include_context 'users'
before(:each) do
@request.host = "#{tenant.subdomain}.lvh.com"
Apartment::Tenant.switch! tenant.subdomain
end
def week_worklog
sql = <<~SQL
SELECT users.first_name as name, SUM(time_doctor_worklogs.length) as data, time_doctor_worklogs.day
FROM users
INNER JOIN time_doctor_worklogs ON time_doctor_worklogs.user_id = users.id
WHERE time_doctor_worklogs.day BETWEEN '#{@today.at_beginning_of_week}' and '#{@today.at_end_of_week}'
GROUP BY time_doctor_worklogs.day, users.id
SQL
query = ActiveRecord::Base.connection.select_all(sql).map do |i|