CSS reference in JSON


Warning: WP_Syntax::substituteToken(): Argument #1 ($match) must be passed by reference, value given in /home/bateeqjg/public_html/news/wp-content/plugins/wp-syntax/wp-syntax.php on line 380

Warning: Undefined array key "layout" in /home/bateeqjg/public_html/news/wp-content/plugins/wp-about-author/wp-about-author.php on line 94

Hey everyone,
I just want post a link to a JSON file that I made as a CSS reference. It’s slightly invalid JSON because it includes functions but that shouldn’t be a problem unless you’re using ajax to transfer the file for some reason. This file was used to make a random css generator and worked out quite nicely.

File: CSS.JSON
Purpose: To provide a JSON lookup for the css properties.
Limitations: Using CSS Version 1 and 2.
Example code

1
2
3
4
5
6
7
...
        "white-space": {
            "info": "Specifies how white-space inside an element is handled",
            "cssVersion": "1",
            "unitType": ["normal", "pre", "nowrap", "pre-wrap", "pre-line"]
        },
...

Larry Battle

Larry Battle

I love to program, and discover new tech. Check out my <a href="http://stackoverflow.com/users/527776/larry-battle">stackoverflow</a> and <a href="https://github.com/LarryBattle">github</a> accounts.

More Posts - Website

Follow Me:Add me on XAdd me on LinkedInAdd me on YouTube

Code of the Day: Javascript Random Number Generator


Warning: WP_Syntax::substituteToken(): Argument #1 ($match) must be passed by reference, value given in /home/bateeqjg/public_html/news/wp-content/plugins/wp-syntax/wp-syntax.php on line 380

Warning: WP_Syntax::substituteToken(): Argument #1 ($match) must be passed by reference, value given in /home/bateeqjg/public_html/news/wp-content/plugins/wp-syntax/wp-syntax.php on line 380

Warning: Undefined array key "layout" in /home/bateeqjg/public_html/news/wp-content/plugins/wp-about-author/wp-about-author.php on line 94

Code
*Updated*

1
2
3
4
5
6
7
8
9
10
//@function: getRandomNum( i, decLen )
/**
* @param i, a number for the number range. [0, i)
* @param decLen, the number of fixed decimal length.
* @returns number that is either a float( number with decimals ) or integer (whole number).
* @note if not arguments are passed, then 0 or 1 is returned.
*/
var getRandomNum = function( i, decLen ){
	return (Math.random() * (i||1) ).toFixed(decLen);
};

Demo
http://jsbin.com/uvuze3/2/

Parameters
Todays code of the day is a random number generator coded in javascript.
getRandomNum() enhances the Math.random() function that javascript provides by offering you the ability to get a random float ( number with decimals ) or integer( whole number ) value.

Example output

1
2
3
4
5
6
//get value from Math.random()
getRandomNum();	//might return 0
//get value between [0,1) with 5 decimals
getRandomNum(1,5);	//might return 0.83034
//get value from [0,99]
getRandomNum(100);	//might return 84

Please leave a comment below.

Larry Battle

Larry Battle

I love to program, and discover new tech. Check out my <a href="http://stackoverflow.com/users/527776/larry-battle">stackoverflow</a> and <a href="https://github.com/LarryBattle">github</a> accounts.

More Posts - Website

Follow Me:Add me on XAdd me on LinkedInAdd me on YouTube

Find equations within chaos.


Warning: Undefined array key "layout" in /home/bateeqjg/public_html/news/wp-content/plugins/wp-about-author/wp-about-author.php on line 94

While I was reading my weekly edition of New Scientist, I found an article that was truly amazing.
In 2009, two Phd scientist at Cornell University developed software that could generate an accurate formula describing an unknown dataset using evolutionary programming as their main tactic. In other words, this program allows you to put in numerical values and you get back an equation that describe it.
The best part of the whole thing is that they released Eureqa (the equation making software) free online for all to download. But… no source code is provided.

For those who don’t know, I once tried to make similar software that use an evolutionary approach to help web designers to craft the prefect CSS layout for their website. However, that didn’t come out too well because of my relative inexperience in the field evolutionary programming and problems associated optimization. But I tried and you can check it out here. Random CSS Generator with Evolution
Well enough of me talking, take a look at the video below to see how Eureqa works.


Try Eureqa and tell me what you think!
Eureqa download (0.83 beta)



Larry Battle

Larry Battle

I love to program, and discover new tech. Check out my <a href="http://stackoverflow.com/users/527776/larry-battle">stackoverflow</a> and <a href="https://github.com/LarryBattle">github</a> accounts.

More Posts - Website

Follow Me:Add me on XAdd me on LinkedInAdd me on YouTube

Join me on Twitter!


Warning: Undefined array key "layout" in /home/bateeqjg/public_html/news/wp-content/plugins/wp-about-author/wp-about-author.php on line 94


Hey Guys and Gals.
Join me on twitter to check the latest updates.
Larry Battle’s Twitter

Larry Battle

Larry Battle

I love to program, and discover new tech. Check out my <a href="http://stackoverflow.com/users/527776/larry-battle">stackoverflow</a> and <a href="https://github.com/LarryBattle">github</a> accounts.

More Posts - Website

Follow Me:Add me on XAdd me on LinkedInAdd me on YouTube