Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View myf9000's full-sized avatar
🏠
Working from home

gkm myf9000

🏠
Working from home
View GitHub Profile
namespace :test_for_stats do
desc "Create data for test displaying charts"
task create_data: :environment do
date = Time.now
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")
@myf9000
myf9000 / groups.rb
Last active September 19, 2016 09:53
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
end
post do
group_params = permitted_params.fetch(:group)
@myf9000
myf9000 / testy
Created September 20, 2016 07:47
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) }
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
t.timestamps
end
class StripeContext
class UseCases
class HandleWebhook
EXPIRES_AT = Time.zone.now + 1.month
USER_PREMIUM_EXPIRES_AT = EXPIRES_AT + 1.day
CUSTOMER_NAME = "customer".freeze
EVENT_TYPES = {
"customer.subscription.created" => "created_subscription",
"invoice.payment_succeeded" => "continued_subscription",
"invoice.payment_failed" => "deleted_subscription",
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
# frozen_string_literal: true
module ProjectApp
module Commands
module UsersProject
class Upsert
include Import["interactors.users_project_repository"]
def call(params)
@params = params
@myf9000
myf9000 / cos_tam.js
Last active February 18, 2018 19:43
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