Skip to content

Instantly share code, notes, and snippets.

View artofhuman's full-sized avatar

Semyon Pupkov artofhuman

View GitHub Profile
import os
def create_db_engine(db_url, **kwargs):
return create_engine(
url=db_url, future=True, **kwargs
)
from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker
Process: Synchronos [96658]
Path: /Applications/Synchronos.app/Contents/MacOS/Synchronos
Identifier: io.synchronos.desktop
Version: 1.2 (1.2.7)
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Synchronos [96658]
User ID: 501
Date/Time: 2021-10-07 19:45:55.937 +0500
// rake users:import[path/to/file/on/s3]
task :import, %i[s3_key] => :environment do |_task, args|
company = User.by_email("owner@workaxle.com").company
departments = {
'Administration' => '1',
'Ventes' => '2',
'Bureau' => '3',
'Production' => '4',
'Entretien' => '5',
module DatasetFilter
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
def filters(filters)
@filters = Array(filters)
end
require 'spec_helper'
require 'ostruct'
class FakePostRepo
attr_reader :posts
def initialize
@posts = []
end
@artofhuman
artofhuman / Dockerfile
Last active September 20, 2017 06:18
Makefile for simplify usage Docker and Docker Compose for Rails app with webpack
FROM ruby:2.4.1-slim
RUN apt-get update -qq \
&& apt-get install -y --no-install-recommends \
apt-transport-https \
curl
RUN curl --silent --location https://deb.nodesource.com/setup_8.x | bash - && \
curl --silent --show-error https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
.hasDatepicker {
background: url(data:image/gif;base64,R0lGODlhEAAQAOZLAP%2F%2B%2Bvn5%2BampqaWlpfT49LGxsfn6%2BaqqqqysrK2tra%2FJ6rzZ8r%2Fb8qWzwpvW%2FM3m%2BrLQ62mm3FmAsWys4o%2FK9pfQ%2BVF8qKenp3ep2q%2FN6XCn28Pd8lCQz7HN6sDAwIO%2B7ZC237GvrlOCvoO04q3M6szk96CgoK6urkBytYm753qx44vA64TI%2BGuz626g1YzA6mKY0Yi86EWO1FiOysTl%2FGSr5ZTC6r3Z8X6p2MHc82Cy70yMzT5vpovQ%2FM%2Fj9Ze%2F6LbT7E%2BCvnTE%2BrnX8FqAqbCwsKioqKKiovz8%2FKampv%2F%2F%2F%2F%2F%2F%2FwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAEsALAAAAAAQABAAAAeigEuCg4SFSxIuGCMpLysxKhowM0EigkQ%2FPiUPNBUUHzYkIDgoghYyEy0sDj1COjURHDs8gg0dEEMLDBs5N0AZCgpGgiFKxQDGxgAAwksJSEfQ0dIBzAhISUoG2NrZR9SC1tgE4uLezAfXSerr6uaCAtfF2Erz7kvw8%2FnFR0jMF0gD1AVMEhBav3dKkChcyPDgEhMFikiceOJAggIFPBjaWCgQADs%3D) 2px 50% no-repeat #fff;
padding-left: 20px!important
}
@artofhuman
artofhuman / authentication.rb
Created January 27, 2017 17:36 — forked from adhrinae/authentication.rb
Hanami User Authentication with session
# web/controllers/authentication.rb
module Web
module Authentication
module Skip
def authenticate!
end
end
def self.included(action)
action.class_eval do
def ind(search_params)
@deliveries = Apress::Notifications::Admin::DeliveriesFinder.new(search_params).call
.paginate(:page => 1, :per_page => 20)
.to_a
@company_counts = Apress::Notifications::Company::SendsLog
.between(search_params[:since], search_params[:till])
.where(delivery_id: @deliveries.flat_map(&:id))
.count(:company_id, distinct: true, group: 'delivery_id')
@artofhuman
artofhuman / proto.rb
Last active September 23, 2016 13:04
require 'pry'
require 'apress/clearance'
require 'apress/orders'
require 'active_record'
require 'active_support'
require 'combustion'
require 'interactor'
require 'tsort'
DO_NOT_REPLY = 'qq'