Skip to content

Instantly share code, notes, and snippets.

Avatar
🤖
👨‍💻

Radoslav Stankov RStankov

🤖
👨‍💻
View GitHub Profile
View explicit_counter_cache.rb
# frozen_string_literal: true
# Complex counter counter caches
#
# Usage:
#
# In parent model
# class Post < ApplicationRecord
# ExplicitCounterCache.define(self, votes_count, -> { votes.active })
# ExplicitCounterCache.define(self, comments_count, -> { votes.visible })
View association_resolver.rb
# frozen_string_literal: true
# Note(rstankov):
#
# **Don't use for `connection`s, only for `field` attributes**
#
# Preload associations.
#
# Supports all preload formats from [ActiveRecord::Base.includes](https://api.rubyonrails.org/v5.2.4/classes/ActiveRecord/QueryMethods.html#method-i-includes).
#
View techlead.md

We are searching for Team Lead to work with product managers, designers, and engineers to shape product direction and deliver great features.

Your responsibilities will include

  • Managing and mentoring your fellow engineers
  • Collaborating closely with product and designer to ship great products
  • Driving your team roadmap, from conception to production
  • Leveraging research and usage data to iterate on these products
  • Brainstorming architecture and product decisions with the team.

How would you spend your time

View resources.md
View graphql_utils.ts
import { ApolloClient } from 'apollo-boost';
import { get as lodashGet } from 'lodash';
interface INode<T> {
node: T;
}
interface IHaveNextPage {
pageInfo: {
hasNextPage: boolean;
View eventBus.ts
import * as React from 'react';
import mitt from 'mitt';
type IEventName =
| 'CommentCreated'
| 'CommentDestroy'
type IEventPaload = any;
type IEventHandler = (payload: IEventPaload) => void;
@RStankov
RStankov / decorators.tsx
Created October 22, 2020 19:02
Draft.js Markdown
View decorators.tsx
import * as React from 'react';
const BOLD_REGEX = /(^|[^\w])\*\*[^\*]+\*\*($|[^\w])/gi;
const ITALIC_REGEX = /(^|[^\w])(^|[^\*])\*[^\*]+\*($|[^\w])/gi;
const UNDERLINE_REGEX = /(^|[^\w])(^|[^\~])\~[^\~]+\~($|[^\w])/gi;
const STIKE_REGEX = /(^|[^\w])\~\~[^\~]+\~\~($|[^\w])/gi;
function boldStrategy(contentBlock: any, callback: any, _contentState: any) {
findWithRegex(BOLD_REGEX, contentBlock, callback);
}
View teamplate.rb
module SEO
def self.for(record)
"::SEO::#{record.class_name}".safe_constantize.new(record)
end
end
class SEO::Base
attr_reader :record
def initialize(record)
View jest.config.js
const testPathIgnorePatterns = ['/node_modules/', '.next/', 'graphql/'];
module.exports = {
reporters: ['default', 'jest-junit'],
projects: [
{
runner: 'jest-runner-prettier',
displayName: 'prettier',
moduleFileExtensions: [
'js',
View yarn_upgarde.rb
data = `yarn outdated`
data = data.split("\n")
index = data.find_index { |line| line =~ /^Package.*Current.*/ }
if index.nil?
print "No new dependancies\n"
exit
end