Skip to content

Instantly share code, notes, and snippets.

xixixao /
Created February 13, 2023 04:41
Better ScrollView for tui-rs
use tui::{
text::{Spans, Text},
widgets::{Block, StatefulWidget, Widget},
use unicode_segmentation::UnicodeSegmentation;
use unicode_width::UnicodeWidthStr;
xixixao /
Last active November 6, 2022 01:00
Testing the signature of all bmesh ops
raw_mesh =
# setup
# end of setup
xixixao / bmesh_api_docs.diff
Last active November 6, 2022 00:50
Changes caused by D16400
View bmesh_api_docs.diff
diff --git a/doc/python_api/rst/bmesh.ops.rst b/doc/python_api/rst/bmesh.ops.rst
index cfd99c1..e44eab5 100644
--- a/doc/python_api/rst/bmesh.ops.rst
+++ b/doc/python_api/rst/bmesh.ops.rst
@@ -15,7 +15,7 @@ Operator Example
This script shows how operators can be used to model a link of a chain.
.. literalinclude:: __/examples/
-.. function:: smooth_vert(bm, verts, factor, mirror_clip_x, mirror_clip_y, mirror_clip_z, clip_dist, use_axis_x, use_axis_y, use_axis_z)
+.. function:: smooth_vert(bm, verts=[], factor=0, mirror_clip_x=False, mirror_clip_y=False, mirror_clip_z=False, clip_dist=0, use_axis_x=False, use_axis_y=False, use_axis_z=False)
xixixao / drawBetterSelection.js
Last active June 13, 2021 04:40
Mac-like selection background for Codemirror6
View drawBetterSelection.js
import { drawSelection, ViewPlugin, Direction } from "@codemirror/view";
import { combineConfig, Facet, EditorSelection } from "@codemirror/state";
const [_, _2, hideNativeSelection] = drawSelection();
const selectionConfig = Facet.define({
combine(configs) {
return combineConfig(
xixixao / testfile.js
Created June 12, 2017 00:28
Test file
View testfile.js
* Given the starting source, starting position, and the ending source this
* function guesses where the cursor should move to.
function updateCursor(
startSource: string,
startPosition: {row: number, column: number},
endSource: string,
): {row: number, column: number} {
for (const accuracy of ACCURACIES) {
View CoffeeScript.tmLanguage
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
# This script create a new repo on, then pushes to it the local repo from the current directory.
# It is a fork of Some of Rob's lines just didn't work for me, and to fix them I needed to make it more verbose so that a mere electrical engineer could understand it.
# This script gets a username from .gitconfig. If it indicates that your default username is an empty string, you can set it with
# git config --add github.user YOUR_GIT_USERNAME
# Gather constant vars
xixixao / discrete-event-simulation
Created December 4, 2013 17:11 Run like: > (new Simulation (ExponentialSampler 2), (ConstantSampler 2)).run 100
View discrete-event-simulation
# (new Simulation (ExponentialSampler 2), (ConstantSampler 2)).run 100
class Simulation
constructor: (@interArrival, @serviceTime) ->
@events = []
@t = 0
@population = 0
xixixao / Switch
Created April 3, 2013 08:59
Clojure vs Coffee
View Switch
#(defn parting
# "returns a String parting in a given language"
# ([] (parting "World"))
# ([name] (parting name "en"))
# ([name language]
# (condp = language
# "en" (str "Goodbye, " name)
# "es" (str "Adios, " name)
# (throw (IllegalArgumentException.
# (str "unsupported language " language))))))
xixixao / gist:e8b74ff74e98bdd0c137
Created March 13, 2015 11:55
LSystems in Shem
View gist:e8b74ff74e98bdd0c137
Rules (type (Map Char String))
System (record angle: Num base: (List Char) rules: Rules)
tree (fn [angle] (System angle
\M "N[-M][+M][NM]"
\N "NN"
\[ "["
\] "]"