• Syntax Highlighting
    32 replies, posted
<ul id="postcxmb" class="forumpanel is-column-mobile postblock postblock-own postblock-read"><li class="postuser"><div class="username user-online"><a href="/#/">Chewgum</a></div> <div class="postavatar is-hidden-mobile"><img src="https://files.facepunch.com/f/ua/671/7326aaf7" width="64" height="64" alt="Avatar of Chewgum"></div> <div class="userscore is-hidden-mobile">                                 1                             </div></li> <li class="postmain"><div><div class="posthead"><a href="/f/nerds/cwfs/1/#postcxmb">54 minutes ago</a> <span> from <strong>Sweden</strong></span> <!----> <!----></div> <div class="quill-editor postbody"> <div class="ql-container ql-bubble ql-disabled"><div class="ql-editor" data-gramm="false" contenteditable="false"><p>trying to do html puts you on the error page</p></div><div class="ql-clipboard" contenteditable="true" tabindex="-1"></div><div class="ql-tooltip ql-hidden"><span class="ql-tooltip-arrow"></span><div class="ql-tooltip-editor"><input type="text" data-formula="e=mc^2" data-link="https://quilljs.com" data-video="Embed URL"><a class="ql-close"></a></div><div class="ql-toolbar"><span class="ql-formats"><button type="button" class="ql-bold"><svg viewBox="0 0 18 18"> <path class="ql-stroke" d="M5,4H9.5A2.5,2.5,0,0,1,12,6.5v0A2.5,2.5,0,0,1,9.5,9H5A0,0,0,0,1,5,9V4A0,0,0,0,1,5,4Z"></path> <path class="ql-stroke" d="M5,9h5.5A2.5,2.5,0,0,1,13,11.5v0A2.5,2.5,0,0,1,10.5,14H5a0,0,0,0,1,0,0V9A0,0,0,0,1,5,9Z"></path> </svg></button><button type="button" class="ql-italic"><svg viewBox="0 0 18 18"> <line class="ql-stroke" x1="7" x2="13" y1="4" y2="4"></line> <line class="ql-stroke" x1="5" x2="11" y1="14" y2="14"></line> <line class="ql-stroke" x1="8" x2="10" y1="14" y2="4"></line> </svg></button><button type="button" class="ql-underline"><svg viewBox="0 0 18 18"> <path class="ql-stroke" d="M5,3V9a4.012,4.012,0,0,0,4,4H9a4.012,4.012,0,0,0,4-4V3"></path> <rect class="ql-fill" height="1" rx="0.5" ry="0.5" width="12" x="3" y="15"></rect> </svg></button><button type="button" class="ql-strike"><svg viewBox="0 0 18 18"> <line class="ql-stroke ql-thin" x1="15.5" x2="2.5" y1="8.5" y2="9.5"></line> <path class="ql-fill" d="M9.007,8C6.542,7.791,6,7.519,6,6.5,6,5.792,7.283,5,9,5c1.571,0,2.765.679,2.969,1.309a1,1,0,0,0,1.9-.617C13.356,4.106,11.354,3,9,3,6.2,3,4,4.538,4,6.5a3.2,3.2,0,0,0,.5,1.843Z"></path> <path class="ql-fill" d="M8.984,10C11.457,10.208,12,10.479,12,11.5c0,0.708-1.283,1.5-3,1.5-1.571,0-2.765-.679-2.969-1.309a1,1,0,1,0-1.9.617C4.644,13.894,6.646,15,9,15c2.8,0,5-1.538,5-3.5a3.2,3.2,0,0,0-.5-1.843Z"></path> </svg></button><button type="button" class="ql-spoiler"></button></span><span class="ql-formats"><button type="button" class="ql-link"><svg viewBox="0 0 18 18"> <line class="ql-stroke" x1="7" x2="11" y1="7" y2="11"></line> <path class="ql-even ql-stroke" d="M8.9,4.577a3.476,3.476,0,0,1,.36,4.679A3.476,3.476,0,0,1,4.577,8.9C3.185,7.5,2.035,6.4,4.217,4.217S7.5,3.185,8.9,4.577Z"></path> <path class="ql-even ql-stroke" d="M13.423,9.1a3.476,3.476,0,0,0-4.679-.36,3.476,3.476,0,0,0,.36,4.679c1.392,1.392,2.5,2.542,4.679.36S14.815,10.5,13.423,9.1Z"></path> </svg></button><button type="button" class="ql-code-block"><svg viewBox="0 0 18 18"> <polyline class="ql-even ql-stroke" points="5 7 3 9 5 11"></polyline> <polyline class="ql-even ql-stroke" points="13 7 15 9 13 11"></polyline> <line class="ql-stroke" x1="10" x2="8" y1="5" y2="13"></line> </svg></button><button type="button" class="ql-blockquote"><svg viewBox="0 0 18 18"> <rect class="ql-fill ql-stroke" height="3" width="3" x="4" y="5"></rect> <rect class="ql-fill ql-stroke" height="3" width="3" x="11" y="5"></rect> <path class="ql-even ql-fill ql-stroke" d="M7,8c0,4.031-3,5-3,5"></path> <path class="ql-even ql-fill ql-stroke" d="M14,8c0,4.031-3,5-3,5"></path> </svg></button></span><span class="ql-formats"><button type="button" class="ql-clean"><svg class="" viewBox="0 0 18 18"> <line class="ql-stroke" x1="5" x2="13" y1="3" y2="3"></line> <line class="ql-stroke" x1="6" x2="9.35" y1="12" y2="3"></line> <line class="ql-stroke" x1="11" x2="15" y1="11" y2="15"></line> <line class="ql-stroke" x1="15" x2="11" y1="11" y2="15"></line> <rect class="ql-fill" height="1" rx="0.5" ry="0.5" width="7" x="2" y="14"></rect> </svg></button></span></div></div></div> <div class="quillselect" style="display: none;"><input type="text"> <!----></div></div> <!---->  <div class="postfoot"><div class="left"><span class="votes"></span></div> <div class="right"><!----> <!----> <span><button class="button is-outline is-small"><span class="icon is-small"><i class="mdi mdi-pencil"></i></span></button> <!----> <!----></span></div></div></div></li></ul>
<li class="threadlastpost is-hidden-touch"><div><a href="/f/general/cwik/4/">2 minutes ago</a></div> <div><span class="username user-online user-moderator user-admin"><a href=""><small>garry</small></a></span></div></li>
Chewgum: trying to do html puts you on the error page Just .NET being dumb, should be okay now
Chewgum: remove this post help.....how the fuck do i exit the code block in this editor Select part of the lines you want outside the code block and click the same symbol again.
<div class='200iq"> I'm a web developer <div/>
Some tests micro.receive( 'login', (args: any, res: Function, rej: Function) => {     if( args.user === 'username' && args.pass === 'password' ) {         res( { token: '123abcd' } );         return;     }     rej(); } ); micro.receive( 'validate', (args: any, res: Function, rej: Function) => {     if( args.token === '123abcd' ) {         res();     }     rej(); } ); . float CurrentAcc = bHasInput ? (Val * Acceleration * GetShipMesh()->GetMass()) : 0;     FVector vAdd = FVector(GetWorld()->GetDeltaSeconds() * CurrentAcc, 0.f, 0.f);     FRotator curRot = GetActorRotation();     FVector wAdd = GetActorRotation().RotateVector(vAdd);     GetShipMesh()->AddForce(wAdd);     FVector cVel = GetShipMesh()->GetPhysicsLinearVelocity();     float cSpeed = cVel.Size();     if (cSpeed >= MaxSpeed) {         GetShipMesh()->SetPhysicsLinearVelocity(cVel.GetSafeNormal(0.f) * MaxSpeed);     } . function meta:Test() MsgN( "test" ); self:DoFunc(); end . void ASolarpowerShipPawn::Thrust_Implementation(float Val) { FVector test = FVector(); }
++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>. Wow, it actually recognises it
Brainfuck syntax support is a must have.
Testing Haskell and F#... main :: IO () main = putStrLn "Hello World" open System [<EntryPoint>] let main argv = printfn "Hello World" Console.ReadLine() |> ignore 0 I really like this! Good job, Garry!
import argparse import struct #import unicode import numpy import dawg def main():     """main func"""     result = parse_args()     idir = result.i     odir = result.o     # read file in     print("opening file {}\n".format(idir))     embs = []     infil = open(idir, "r", encoding="utf-8") ..........     res = parser.parse_args()     return res if __name__ == '__main__':     main()
Looks cool         private delegate void ReadXmlDelegate(XmlReader reader, IsometricMap map);         //<map .../> Attribute mapping.         Dictionary<string, ReadXmlDelegate> mapAttributeMap;         //<xml/> Parent nodes         Dictionary<string, ReadXmlDelegate> nodeMap;         private void InitializeStrategyMaps()         {             mapAttributeMap = new Dictionary<string, ReadXmlDelegate>() {             { "width", (r, map) => { map.Width = r.ReadContentAsInt(); } },             { "height", (r, map) => { map.Height = r.ReadContentAsInt(); } },             { "tilewidth", (r, map) => { map.TileWidth = r.ReadContentAsInt(); } },             { "tileheight", (r, map) => { map.TileHeight = r.ReadContentAsInt(); } }             };
I hate Courier
Very nicely done!
function [centroids, memberships] = km(X, initial_centroids, max_iters)     %KMEANS Run the k-means clustering algorithm on the data set X.     %   [centroids, memberships] = KMEANS(X, initial_centroids, max_iters)     %   Runs the k-means algorithm on the dataset X where 'k' is given by the     %   number of initial centroids in 'initial_centroids'     %     %   This function will test for convergence and stop when the centroids don't     %   change from one iteration to the next. It will also break after 'max_iters'     %   iterations.       %     %   The initial centroids should all be unique. They are typically taken      %   randomly from the data set. Note that     %   the choice of initial centroids will affect the final clusters. To get     %   repeatable results from k-means, you need to use the same initial      %   centroids.     %     %   Parameters     %     X                 - The dataset, with one example per row.     %     initial_centroids - The initial centroids to use, one per row (there     %                         should be 'k' rows).     %     max_iters         - The maximum number of iterations to run (k-means will     %                         stop sooner if it converges).     %   Returns     %     centroids    -  A k x n matrix of centroids, where n is the number of      %                    dimensions in the data points in X.     %     memberships  - A column vector containing the index of the assigned      %                    cluster (a value between 1 - k) for each corresponding      %                    data point in X.     % Get 'k' from the size of 'initial_centroids'.     k = size(initial_centroids, 1);     centroids = initial_centroids;     prevCentroids = centroids;     % Run K-Means     for i = 1 : max_iters         % Output progress         %fprintf('K-Means iteration %d / %d...\n', i, max_iters);         %fflush(stdout);         % For each example in X, assign it to the closest centroid         memberships = findClosestCentroids(X, centroids);         % Given the memberships, compute new centroids         centroids = computeCentroids(X, centroids, memberships, k);         % Check for convergence. If the centroids haven't changed since         % last iteration, we've converged.         if (prevCentroids == centroids)             %fprintf("  Stopping after %d iterations.\n", i);             %if exist('OCTAVE_VERSION') fflush(stdout); end;             break;         end         % Update the 'previous' centroids.         prevCentroids = centroids;     end end matlab test
Might help by adding more languages to the webpack
Now be all fancy and make it so it uses Operator Mono
Operator mono is a meme and you know it.
I am giving you that it is very pricey. But I actually do think its somewhat helpful.
How do you people use huge fonts like that? everything feels claustrophobic
you do know that font style != font size, right?
Right, but you can't just make the font size smaller or it starts getting blurry and crap. at least on atom and vscode
Operator pretty much needs to be at least slightly bigger than your average monospace.
but but ... do you all really have such tiny screens?
in vscode with operator mono at size 16(or whatever the default is) I can only see ~50 lines, that's not close to enough. as far as I know most people are using 1080p 24" and not huge 4k monitors with shitloads of space.
Sorry, you need to Log In to post a reply to this thread.