Sony’s playstation website reported high load during the PS4 launch,
PS4 specs released so far,
*Supercharged PC Architecture
*X86 CPU – 8 cores
*Enhanced PC GPU – 2 teraflops
*8 GB RAM – GDDR5
*Local HDD
Sony’s playstation website reported high load during the PS4 launch,
PS4 specs released so far,
*Supercharged PC Architecture
*X86 CPU – 8 cores
*Enhanced PC GPU – 2 teraflops
*8 GB RAM – GDDR5
*Local HDD
so, what is sublime text?
as it’s website says,
Sublime Text is a sophisticated text editor for code, markup and prose.
You’ll love the slick user interface, extraordinary features and amazing performance.
is it available in the ubuntu repo? yes, but not the latest version.
so, to install sublime text 2 do the following,
sudo add-apt-repository ppa:webupd8team/sublime-text-2 sudo apt-get update sudo apt-get install sublime-text
btw, it’s free to evaluate and the licence costs about $49. if you’re a developer, i’m sure this money is well spent.
ipads are becoming one of the most used interface for the internet, here’s a simple snippet to detect if the user is on ipad.
var isiPad = navigator.userAgent.match(/iPad/i) != null; var ua = navigator.userAgent; var isiPad = /iPad/i.test(ua) || /iPhone OS 3_1_2/i.test(ua) || /iPhone OS 3_2_2/i.test(ua);
[courtesy : http://davidwalsh.name/detect-ipad]
You might want to change the colour of the user selected text in your website. This is possible in latest browsers (not counting IE
)
::selection {
background: #a6ffa6;
}
::-moz-selection {
background: #a6ffa6;
}
This style can also be applied to specific elements. how?
Arrays can be sorted using the sort() method in javascript, however this method cannot be applied to javascript objects.
function sortObject(obj){
var objArray = [];
for(e in obj){
objArray.push([e,obj[e]]);
}
objArray.sort(function(a, b) {return b[1] - a[1]});
return objArray;
}
The function will return a 2 dimensional array sorted in descending order. So, how do you sort it in ascending order?
Even the simplest of the websites found on the internet now support user registration and one of the hassles in creating a user registration system is validation the information
function is_valid_email($email){
return preg_match("/^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,3})$/i", $email)
}
function is_valid_phone($phone){
return preg_match("/^(\s*\(?0\d{4}\)?(\s*|-)\d{3}(\s*|-)\d{3}\s*)|(\s*\(?0\d{3}\)?(\s*|-)\d{3}(\s*|-)\d{4}\s*)|(\s*(7|8)(\d{7}|\d{3}(\-|\s{1})\d{4})\s*)$/i",$phone);
}
More regular expressions can be found at http://regexlib.com
Changing a link text colour on mouse hover is cool. But do you know, you can add some super cool fading effect to your link texts?
a{
color:#AAA;
-webkit-transition: color 300ms ease-in 200ms;
-moz-transition: color 300ms ease-in 200ms;
-o-transition: color 300ms ease-in 200ms;
transition: color 300ms ease-in 200ms;
}
a:hover{
color: #000;
}
The transition property has 3 parameters, “property duration effect delay”. It works on all recent browsers.
When using a dynamic overlay in a page, you might want to allow the user to use ‘escape’ key to close the overlay in addition to the close button.
$(document).keyup(function(e) {
if (e.keyCode == 27) { alert('escaped!'); }
});
Escape key is detected only in “keyup” not in “keypress”.
This snippet comes in handy when you store a tree structure as a table database and want to convert it back to a tree structure.
function constructTree($data){
$index = array();
$tree = array();
foreach ($data as $key=>&$row) {
$index[$key] = &$row;
$row['children'] = array();
if ($row['parentid'] == 0) {
$tree[$key] = &$row;
}
}
foreach ($data as $key=>&$row) {
$index[$row['parentid']]['children'][$key] = &$row;
if(isset($row['parent']))$index[$row['parentid']]['parent'] = $row['parent']+1;
}
return $tree;
}