Instantly share code, notes, and snippets.
WilliamVenner /fib.rs
CreatedJune 14, 2022 10:02
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| fn fib<T>(n:T) ->T | |
| where | |
| T: core::cmp::PartialOrd + core::ops::Sub<Output =T> + core::ops::AddAssign + num::One + num::Zero +Clone | |
| { | |
| if n <=T::zero(){returnT::one()}; | |
| if n ==T::one() || n ==T::one() +T::one(){returnT::one()}; | |
| letmut a =T::zero(); | |
| letmut b =T::one(); |
WilliamVenner /discord_server_emoji_dump.js
CreatedMarch 3, 2022 14:28
Dump emoji URLs from your server This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| console.log([...document.querySelectorAll('.emojiColumn-2P3Fj1 .emojiImage-1sHmM-')].map(elem=>{ | |
| consturl=elem.style.backgroundImage.replace(/.*(http.+?)"\)/,'$1').replace('.webp','.png').replace(/size=\d+&/,''); | |
| constext=url.match(/\d+\.(\S+?)\?.+$/)[1]; | |
| return'wget '+url+' -O '+elem.parentNode.parentNode.querySelector('.emojiInput-B8MGXq').value+'.'+ext; | |
| }).join('\n')); |
WilliamVenner /new-drm.md
Last activeJuly 5, 2021 01:06
WilliamVenner /johnlua.json
CreatedJune 25, 2021 23:39
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| ["An error doesn't become a mistake until you refuse to correct it.","In the beginning was the Statement, and the Statement was with Lua, and the Statement was Lua.","Lua was the answer to my prayers.","Greater love has no one than Lua, that the compiler lay down his life for our code.","Do not think that I will debug with the Stack Trace; For had ye believed the Compiler Errors, ye would have believed Me, for he wrote of Lua; But if ye believe not his Stack Traces, how shall ye believe My code?","Even though my types remain weak, I fear no error, for Lua is with me.","Thinking will not overcome bugs, but action will.","Lua is what the heart needs all the time.","Lua is the chain that ties our health and bodies together.","Spam is only another flower to be picked in the path to find Lua.","Do not let your code be troubled. Trust in Lua; trust also in me.","Rip scripts, you must not. Let the Lua flow straight from your fingers.","Variables are changed by your example, not by your opinion.","The meaning of Lua |
WilliamVenner /treemap.rs
CreatedMarch 21, 2021 01:14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| // https://www.win.tue.nl/~vanwijk/stm.pdf | |
| use treemap::TreeMap; | |
| mod treemap{ | |
| use serde::Serialize; | |
| usesuper::AnalyzedAddon; | |
| #[derive(Debug,Clone,Serialize)] | |
| pub(super)structMappedGMAFile{ | |
| #[serde(flatten)] | |
| pub(super)inner:AnalyzedAddon, |
WilliamVenner /WebView2Experimental.idl
CreatedMarch 4, 2021 21:24
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| // Copyright (C) Microsoft Corporation. All rights reserved. | |
| // Use of this source code is governed by a BSD-style license that can be | |
| // found in the LICENSE file. | |
| // These are the WebView2 experimental APIs published publicly as a part of the | |
| // WebView2 prerelease package. Modifications to any published interface require | |
| // a breaking change for the experimental APIs. Otherwise, do not modify | |
| // published interfaces. | |
| // midl is run from a tools directory with no special include paths setup. |
WilliamVenner /ease_lib_test.js
Last activeFebruary 5, 2021 17:14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| vartests={}; | |
| tests.InSine=function(x){ | |
| return1-Math.cos((x*Math.PI)/2); | |
| } | |
| tests.OutSine=function(x){ | |
| returnMath.sin((x*Math.PI)/2); | |
| } |
WilliamVenner /ease_lib_test_results.json
Last activeFebruary 5, 2021 17:16
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| { | |
| "InQuint": [ | |
| 0, | |
| 0, | |
| 0, | |
| 4.235164736271502e-22, | |
| 0, | |
| 6.776263578034403e-21, | |
| 1.3552527156068805e-20, | |
| 0, |
WilliamVenner /ease_lib_test_data.json
Last activeFebruary 5, 2021 17:14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| {"InQuint":{"0":0.0,"1":1.0000000000000002e-8,"2":3.2000000000000008e-7,"3":0.0000024299999999999998,"4":0.000010240000000000002,"5":0.00003125000000000001,"6":0.00007775999999999999,"7":0.00016807000000000006,"8":0.00032768000000000006,"9":0.0005904899999999999,"10":0.0010000000000000003,"11":0.00161051,"12":0.0024883199999999998,"13":0.0037129300000000007,"14":0.005378240000000002,"15":0.007593749999999998,"16":0.010485760000000002,"17":0.014198570000000004,"18":0.018895679999999999,"19":0.02476099,"20":0.03200000000000001,"21":0.04084100999999999,"22":0.05153632,"23":0.06436343000000002,"24":0.07962623999999999,"25":0.09765625,"26":0.11881376000000002,"27":0.14348907000000006,"28":0.17210368000000007,"29":0.20511148999999993,"30":0.24299999999999995,"31":0.28629150999999999,"32":0.33554432000000009,"33":0.3913539300000001,"34":0.45435424000000015,"35":0.5252187499999999,"36":0.6046617599999999,"37":0.6934395699999999,"38":0.79235168,"39":0.9022419900000002,"40":1.0240000000000003,"41":1.1585620099999996,"4 |
WilliamVenner /ease_lib_converter.lua
CreatedDecember 18, 2020 21:20
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| file.Delete("easings.js.txt","DATA") | |
| localeasingsJS=file.Open("easings.js.txt","ab","DATA") | |
| easingsJS:Write("var tests = {};\n") | |
| file.Delete("easings.lua.txt","DATA") | |
| localeasings=util.JSONToTable(file.Read("easings.json","DATA")) | |
| localeasingsLua=file.Open("easings.lua.txt","ab","DATA") | |
| localfunctionconvertIndent(code) | |
| code=code:gsub("^","\t"):gsub("\n","\n\t") |
NewerOlder