Skip to content

Instantly share code, notes, and snippets.

View RStankov's full-sized avatar
🤖
👨‍💻

Radoslav Stankov RStankov

🤖
👨‍💻
View GitHub Profile
@RStankov
RStankov / decorators.tsx
Created October 22, 2020 19:02
Draft.js Markdown
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);
}
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)
const testPathIgnorePatterns = ['/node_modules/', '.next/', 'graphql/'];
module.exports = {
reporters: ['default', 'jest-junit'],
projects: [
{
runner: 'jest-runner-prettier',
displayName: 'prettier',
moduleFileExtensions: [
'js',
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
# frozen_string_literal: true
module SpecSupport
module GraphHelper
def execute_mutation(current_user: nil, context: {}, **inputs)
context = Graph::Context.new(
query: OpenStruct.new(schema: StacksSchema),
values: context.merge(current_user: current_user),
object: nil,
)
function buildNode(todo) {
return {
todo,
children: [],
};
}
function buildTree(todos) {
const root = buildNode();
/*
Do you use?:
Question
Alternative(product)
Note(product)
Thanks
Add to Stack:
ProductSearch
# Note(rstankov):
#
# Preload associations
#
# **Don't use for `connection`s, only for `field` attributes**
#
# supported definitions:
# - [x] :assoc
# - [x] { assoc: :assoc }
# - [x] { assoc: { assoc: :assoc } }
export default miniStateMachine<IComponentProps>({
initialState,
actions,
components: {
search: Search,
newProduct: NewProduct,
product: Poduct,
},
// WIP
/*
Render as html
<div data-component="Calendar" data-props="<%= json date: Date.today, maxDate: 1.week.from_now %>">
</div>
*/
// during page load
$(document).ready(() => {
$('[data-components]').each((i, el) => {
buildReact(el);