Skip to content

Instantly share code, notes, and snippets.

@jacobslusser
jacobslusser / Transport.cs
Created November 14, 2023 22:26
Proper DoSend pipeline loop
while (true)
{
// Get data from the send buffer
var result = await reader.ReadAsync().ConfigureAwait(false);
if (result.IsCanceled)
{
break;
}
// Write to the socket
@jacobslusser
jacobslusser / LuaRecipe.cs
Created March 20, 2017 15:55
ScintillaNET Lua Automatic Syntax Highlighting and Folding
// Extracted from the Lua Scintilla lexer and SciTE .properties file
var alphaChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
var numericChars = "0123456789";
var accentedChars = "ŠšŒœŸÿÀàÁáÂâÃãÄäÅåÆæÇçÈèÉéÊêËëÌìÍíÎîÏïÐðÑñÒòÓóÔôÕõÖØøÙùÚúÛûÜüÝýÞþßö";
// Configuring the default style with properties
// we have common to every lexer style saves time.
scintilla.StyleResetDefault();
scintilla.Styles[Style.Default].Font = "Consolas";
@jacobslusser
jacobslusser / app.js
Last active December 22, 2017 00:52
A RequireJS plugin for loading and registering Knockout components/templates
// The component is required using the 'component!' plugin we created. This will load
// 'page1.html' and 'page1.js' and return 'page1.js' to us.
define(['knockout', 'component!page1'], function (ko, Page1) {
'use strict';
function App() {
var args = { name: 'Jacob' };
// Example of using the component binding with the automatically registered component
@jacobslusser
jacobslusser / CSharpRecipe.cs
Created June 5, 2015 02:35
ScintillaNET C# Automatic Syntax Highlighting
// For an explanation of this code visit:
// https://github.com/jacobslusser/ScintillaNET/wiki/Automatic-Syntax-Highlighting
// Configuring the default style with properties
// we have common to every lexer style saves time.
scintilla.StyleResetDefault();
scintilla.Styles[Style.Default].Font = "Consolas";
scintilla.Styles[Style.Default].Size = 10;
scintilla.StyleClearAll();
@jacobslusser
jacobslusser / PythonRecipe.cs
Created June 5, 2015 02:05
ScintillaNET Python Configuration
// Reset the styles
scintilla.StyleResetDefault();
scintilla.Styles[Style.Default].Font = "Consolas";
scintilla.Styles[Style.Default].Size = 10;
scintilla.StyleClearAll(); // i.e. Apply to all
// Set the lexer
scintilla.Lexer = Lexer.Python;
// Known lexer properties: