Skip to content

Instantly share code, notes, and snippets.

Working from home

Gilbert Komin myf9000

Working from home
View GitHub Profile
View cos_tam.js
var fs = require('fs');
var formidable = require('formidable');
ogólnie fajnie byłoby użyć es5/es6 i np zamiast var używać const i let
i import mógłby wyglądać tak
import fs from 'fs';
i fs możesz używać normalnie jak z require
View upsert.rb
# frozen_string_literal: true
module ProjectApp
module Commands
module UsersProject
class Upsert
include Import["interactors.users_project_repository"]
def call(params)
@params = params
View update.rb
module Slack
module UseCases
module Users
class Update
include Import[user_repository: "repositories.user_repository"]
def initialize(
slack_api: ::Slack::Services::SlackApi,
create_command: ::Slack::Commands::Create,
archive_command: ::Slack::Commands::Archive
View handle_webhook.rb
class StripeContext
class UseCases
class HandleWebhook
EXPIRES_AT = + 1.month
CUSTOMER_NAME = "customer".freeze
"customer.subscription.created" => "created_subscription",
"invoice.payment_succeeded" => "continued_subscription",
"invoice.payment_failed" => "deleted_subscription",
View migration
class CreateUsersPropositions < ActiveRecord::Migration
NOW_QUERY = "CAST(NOW() at time zone 'utc' AS timestamp)"
def up
create_table :widget_to_do_users_propositions do |t|
t.integer :user_id
t.integer :proposition_id
View testy
require "spec_helper"
describe Actions::HR::Groups::AssignMembersGroup, sidekiq: false do
let!(:tag_first) { create(:tag) }
let!(:tag_second) { create(:tag) }
let!(:organization) { create(:organization) }
let!(:action_maker) { create(:employee, organization: organization) }
let!(:group) { create(:group, organization: organization) }
View groups.rb
desc "V3::Create a group"
params do
use :group_params
requires :send_group_invitation_email,
type: Boolean,
desc: "Send invitations to group users?"
optional :private, type: Boolean, default: false
post do
group_params = permitted_params.fetch(:group)
View rake for stats
namespace :test_for_stats do
desc "Create data for test displaying charts"
task create_data: :environment do
date =
year = date.strftime("%Y")
quarter = date.strftime("%Y")+"Q#{1 + ((date.month - 1) / 3)}"
month = date.strftime("%Y%m")
week = date.strftime("%Y%V")
yesterday = date.yesterday.strftime("%Y%m%d")
You can’t perform that action at this time.