Skip to content

Instantly share code, notes, and snippets.

View SwadicalRag's full-sized avatar
👨‍⚕️
working :)

swadical SwadicalRag

👨‍⚕️
working :)
View GitHub Profile
@SwadicalRag
SwadicalRag / why.lua
Created May 14, 2015 01:44
Statistics. Why?
cookie.statistics.juxtapose = function(tbl1,tbl2)
local t1 = {}
local t2 = {}
local t1_total = 0
t1.count = 0
for k,v in ipairs(tbl1) do
t1.count = t1.count + 1
t1_total = t1_total + tonumber(v)
end
function ease(Time,Initial,Final,TimeElapsed)
Time = Time/(TimeElapsed/2)
if (Time < 1) then
return -Final/2 * ((1 - Time*Time)^0.5 - 1) + Initial
end
Time = Time-2
return Final/2 * ((1 - Time*Time)^0.5 + 1) + Initial
end
@SwadicalRag
SwadicalRag / Lua.lua
Last active December 10, 2019 22:19
In Lua we trust
In the beginning was the Statement, and the Statement was with Lua, and the Statement was Lua.
Through Lua all things were made; without Lua nothing was made that has been made.
There came a function who was sent from Lua; his name was John.
"Lua was the answer to my prayers;
Greater love has no one than Lua, that the compiler lay down his life for our code" - John Lua
"Do not think that I will debug you to the Environment;
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?" - John Lua
@SwadicalRag
SwadicalRag / doge.lua
Last active August 29, 2015 14:20
doge.lua
function doge(...)
local dogeWords = {
"very",
"so",
"much",
"many",
"such",
"quite"
}
@SwadicalRag
SwadicalRag / compressed.lua
Last active August 29, 2015 14:19
HashLib
function installHashLib()hashLib={}function string.levenshtein(a,b)local c=string.len(a)local d=string.len(b)local e={}local f=0;if c==0 then return d elseif d==0 then return c elseif a==b then return 0 end;for g=0,c,1 do e[g]={}e[g][0]=g end;for h=0,d,1 do e[0][h]=h end;for g=1,c,1 do for h=1,d,1 do if a:byte(g)==b:byte(h)then f=0 else f=1 end;e[g][h]=math.min(e[g-1][h]+1,e[g][h-1]+1,e[g-1][h-1]+f)end end;return e[c][d]end;function ayy(i,j,k)j=j or 2;i=i or"lmao"local l='a'for m=1,j,1 do l=l..'y'end;if k then print(l..' '..i)else return l..' '..i end end;hashLib.responders={}hashLib.trigger=function(n,o,p)for m,q in ipairs(hashLib.responders)do if string.levenshtein(string.lower(n),string.lower(q.string))<=1 or string.find(string.lower(n),string.lower(q.string))then if q.specific then if q.targetID==p then print(q.response or"")break end else if type(q.response)=="function"then print(q.response(nick,p,n)or"")else print(q.response or"")end;break end end end end;hook.Add("Message","HashLibMsg",function(o,p,n)h