Must code be attached to a game object to be called?

I am trying to use some of the code from the unify community site. For example, I am trying to call the Mathfx C# routines from javascript. I have been able to call C# routines from js OK, using GetComponent.

Can I put the C# in the Assets or other project resources folders and somehow call the routine like it is a built-in function?

Like this: x = Mathfx.Bounce(y);

Or -- does all code at some point have to be attached to a game object to be "in the game."

That is fine, as long as The Mathfx class is compiled first and that is a class method. Unity includes all your scripts in the final build so unlike some assets, you must manually remove unused scripts from your assets folder. That means you can reference them if they are not attached to a game object assuming they are `static` which your's is.