Skip to content

Instantly share code, notes, and snippets.

@slava-vishnyakov
slava-vishnyakov / readme.md
Last active May 7, 2024 04:49
How to upload images with TipTap editor
  1. Create a file Image.js from the source below (it is almost a copy of Image.js from tiptap-extensions except that it has a constructor that accepts uploadFunc (function to be called with image being uploaded) and additional logic if(upload) { ... } else { ... previous base64 logic .. } in the new Plugin section.
import {Node, Plugin} from 'tiptap'
import {nodeInputRule} from 'tiptap-commands'

/**
 * Matches following attributes in Markdown-typed image: [, alt, src, title]
 *
@superseb
superseb / create_user_and_kubeconfig_rancher2.sh
Last active November 1, 2023 18:51
Create local user and generate kubeconfig in Rancher 2 via API
#!/bin/bash
RANCHERENDPOINT=https://your_rancher_endpoint/v3
# The name of the cluster where the user needs to be added
CLUSTERNAME=your_cluster_name
# Username, password and realname of the user
USERNAME=username
PASSWORD=password
REALNAME=myrealname
# Role of the user
GLOBALROLE=user
@goerz
goerz / revtex.tplx
Last active February 22, 2021 09:33
custom jupyter nbconvert latex template, using revtex
((*- extends 'article.tplx' -*))
% See http://blog.juliusschulz.de/blog/ultimate-ipython-notebook#templates
% for some useful tips
%===============================================================================
% Document class
%===============================================================================
((* block docclass *))
@aplavin
aplavin / mywidgets.py
Created August 20, 2016 15:51
ipywidgets extensions
import ipywidgets as iw
import traitlets
class SelectionSliderBtns(iw.Box):
description = traitlets.Unicode()
value = traitlets.Any()
options = traitlets.Union([traitlets.List(), traitlets.Dict()])
def __init__(self, **kwargs):
@mwaskom
mwaskom / seaborn_dark_background.ipynb
Created December 3, 2015 19:49
Use seaborn with a dark background, if you like that sort of thing.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.