Whitespace Preservation in Less Escaping for Calc Operands in CSS3

Whitespace preservation in LESS escaping for calc operands in CSS3

This is kind of an old post but I wanted to show you a simple mathematic workaround for this.

I also have this issue with my minifying engine. Mine works fine with substraction but remove whitespace in addition. If someone have the same problem, this is the simplest workaround.

If you want this:

.a {
min-height: ~'calc(2em + 4px)';
}

Write it as this instead:

.a {
min-height: ~'calc(2em - -4px)';
}

Using Less, CSS3 calc() doesn't work correctly

Less will try to process all maths including 100% + 20px.

You could either set Strict Math on:

lessc -sm=on
lessc --strict-math=on

Or use a tilde-quote ~"100% + 20px" in order to prevent the statement from being processed by Less.

For instance:

.class {
padding-left: calc(~"100% + 20px");
}

Why is less precomputing the viewport height in calc()?

You have to use "escape" function as suggested in this answer to a similar question.

width:calc(100vh ~"-" 50px);

.NET - create instance of each type that implements specific interface

I'm not familiar with StructureMap. Anyway you need to have the list of types implementing IModule, then you create an object of each type in the list.

To get the list of types dynamically, it can be:

var types =
from asm in AppDomain.CurrentDomain.GetAssemblies()
from type in asm.GetType()
where !type.IsAbstract
where typeof(IModule).IsAssignableFrom(type)
select type;

To instantiate the types:

IModule[] instances = (
from type in types
select (IModule)Activator.CreateInstance(type))
.ToArray();

What's best way to secure a database connection string?

If the machine really is being administered in the traditional Unix fashion, where J. Random user isn't off su-ing to root all the time, I'd say that filesystem permissions are your best bet. If someone gets unauthorized root access, no amount of encryption silliness is going to "secure" the connection string.

I'd mark the files w/ the connection string as owned by the "script user" and give them access as you describe.

(Bravo for realizing that encrypting the connection string doesn't buy you anything, in this example. Security through obscurity is counter-productive.)



Related Topics



Leave a reply



Submit