some that i can think of are
font: bold 20px Verdana, sans-serif /* one line for variant, size, and family */
color: #336 /* short color code */
height: 0 /* no need to specify unit when 0 */
border: 0 /* same effect as border: none but shorter */
background: #ffc /* no need to use background-color if all is wanted is color *...
I'm used to using the if else shorthand:
var = (if statement) ? 'something' : 'something else';
Are there any other short hand methods available?
...
Is there an easy way to create a multiline string literal in C#?
Here's what I have now:
string query = "SELECT foo, bar"
+ " FROM table"
+ " WHERE id = 42";
I know PHP has
<<<BLOCK
BLOCK;
Does C# have something similar?
...
Simple. If I use:
public void Add(params int[] values)
Then I can use this as:
Add(1, 2, 3, 4);
But now I'm dealing with key-value pairs! I have a KeyValue class to link an integer to a string value. So I start with:
public void Add(params KeyValue[] values)
But I can't use this:
Add(1, "A", 2, "B", 3, "C", 4, "D");
Instead, ...
Hi,
I'm building some simple validation rules in php and my IDE (phped) is complaining about the syntax.
Can anyone tell me what is wrong with the following?
function notBlank($str) {
(strlen($str) == 0) ? return false : return true;
}
phped complains of 'unexpected return'
Any advice appreciated.
Thanks.
...
Is there a way to write a query equivalent to
select * from log_table where dt >= 'nov-27-2009' and dt < 'nov-28-2009';
but where you could specify only 1 date and say you want the results for that entire day until the next one.
I'm just making this up, but something of the form:
select * from log_table where dt = 'nov-27-2009':+1;...
Hello,
How does a developer do the equivalent of this in managed c++? :
c# code
public String SomeValue
{
get;
set;
}
I've scoured the net and found some solutions, however it is hard to distinguish which is the correct (latest, .NET 3.5) way, given the colourful history of getters/setters and managed c++.
Thanks!
...
How to convert all color code #XXYYZZ to shorter 3 character version #XYZ of whole css file?
...
In Javascript, after executing a function I can immediately get the an element of the array returned by the function, like so:
myFunc("birds")[0] //gets element zero returned from "myFunc()"
This is much easier and faster than doing this:
$myArray = myFunc("birds");
echo $myArray[0];
Does PHP have a similar shorthand to javascript?...
Suppose I have:
Foo foo;
is there a shorthand for this?
foo.operator->().operator()(1, 2);
...
I'd like to define a shorthand command for \begin{align*} and \end{align*}. When I write
\newcommand{\ba}{\begin{align*}}
it works fine. But when I write
\newcommand{\ea}{\end{align*}}
latex complains. It looks like it's interpreting it as part of the environment and is not happy with that. Anyone know how to fix this?
...
i am using border on object.
like
.box{
border-left:solid 1px #000;
border-right:solid 1px #000;
border-bottom:solid 1px #000;
width:50px;
height:50px;
}
may i write this in shorthand?
...
I remember reading an article about a shorthand version, or extension, of HTML a few months ago. Its purpose was to make HTML code significantly more concise, by removing end tags, and it may have allowed loops of some sort as well. I want to use it now, but I can't seem to remember what it was called.
Searching online, I found HAML, b...
if $('.item:last').attr('id').split('-')[1] is not undefined var liid equals that, and if it is undefined then it equals null
...
In scheme, why is this:
(define foo
(lambda (x)
42))
considered better style than this:
(define (foo x)
42)
And is there any reason to favour one over the other?
...
As I understand it, when you use the shorthand property background, the browser first sets all background properties to their default values and then puts in the values that you're declaring. Is it then better to use background-color:white; instead of background:white? Does this change when you are putting in more values such as backgrou...
A JavaScript function I made needs to parse all CSS values that don't necessarily have 'one' value attached to them. For example, margin:0 0 4px 12px; is actually four values (margin-top, margin-right, etc).
Basically, all I need is a list of the shorthand properties. However, I don't need all shorthand css. I just need the shorthand cs...
I have this code in a function, and want to shorten it - it applies the same style to every item in an array.
document.getElementById(divsArray[0]).style.visibility='hidden';
document.getElementById(divsArray[1]).style.visibility='hidden';
document.getElementById(divsArray[2]).style.visibility='hidden';
document.getElementB...
Essentially, I'd love to be able to define a variable as one thing unless that thing doesn't exist. I swear that somewhere I saw a shorthand conditional that looked something like this:
$var=$_GET["var"] || "default";
But I can't find any documentation to do this right, and honestly it might have been JS or ASP or something where I sa...
Using a watermark plugin for jQuery, I'm attempting to jslint and minimize the functions but I've come across syntax I have never seen before wherein there are expressions where there really ought to be an assignment or function call:
(function($) {
$.fn.watermark = function(css, text) {
return this.each(function() {
...