Wednesday, April 29, 2015

HTML Table DOM:


var table = document.getElementsByTagName("Table");

var result = table[0];
var len = result.rows.length;

for(var i=1; i < len; i++){
  //console.log(row);
  var emailId = result.rows[i].cells[1].innerHTML;
  console.log(emailId);
}

Monday, April 27, 2015

Script to extract emails from WebPage:


var text = document.body.innerHTML;
function extractEmails (text)
{
    return text.match(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)/gi);
}

document.write(extractEmails(text).join('
'));

alert(extractEmails(text).join('\n'));


Cell Separator Inset:



For iOS 7.0:
============

if ([tableView respondsToSelector:@selector(setSeparatorInset:)]) {
    [tableView setSeparatorInset:UIEdgeInsetsZero];
}

or

[tableView setSeparatorInset:UIEdgeInsetsZero];
   
   
For iOS 8.0:
============

tableView.layoutMargins = UIEdgeInsetsZero;
cell.layoutMargins = UIEdgeInsetsZero;


======================================================


-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
    // Remove seperator inset
    if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {
           [cell setSeparatorInset:UIEdgeInsetsZero];
    }

    // Prevent the cell from inheriting the Table View's margin settings
    if ([cell respondsToSelector:@selector(setPreservesSuperviewLayoutMargins:)]) {
        [cell setPreservesSuperviewLayoutMargins:NO];
    }

    // Explictly set your cell's layout margins
    if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
        [cell setLayoutMargins:UIEdgeInsetsZero];
    }
}