This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function getQuetesv2($ticker) | |
{ | |
$infoUrl='https://finance.google.com/finance?q=idx:'.$ticker.'&output=json'; | |
$contents = str_replace('//','',file_get_contents($infoUrl)); | |
$json = json_decode($contents, true); | |
if(!array_key_exists("results_type",$json)){ | |
$data=$json[0]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isNumeric(n) | |
{ | |
var n2 = n; | |
n = parseFloat(n); | |
return (n!='NaN' && n2==n); | |
} | |
if (! $.isNumeric(unit_price)) | |
{ | |
// do something |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getItemByItemVal(obj, itemName, itemVal) | |
{ | |
var retObj = {}; | |
for (var k in obj) | |
{ | |
if (obj.hasOwnProperty(k)) | |
{ | |
var item = obj[k]; | |
if (item.hasOwnProperty(itemName) && item[itemName] == itemVal) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getKeys(obj) { | |
var r = [] | |
for (var k in obj) { | |
if (!obj.hasOwnProperty(k)) | |
continue | |
r.push(k) | |
} | |
return r | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class BlogController extends Controller | |
{ | |
/** | |
* Posts | |
* | |
* @return void | |
*/ | |
public function showPosts() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// controller | |
public function getDetails($id) | |
{ | |
//Retrieve post details | |
$data["post"] = Blog::post_details($id); | |
//Retrieve comments for this post | |
$data["comments"] = $comments = Blog::post_comments($id,4); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class BlogController extends Controller | |
{ | |
/** | |
* Posts | |
* | |
* @return void | |
*/ | |
public function showPosts() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.fn.removeCss=function(all){ | |
if(all===true){ | |
$(this).removeAttr('class'); | |
} | |
return $(this).removeAttr('style') | |
} | |
//For your case ,Use it as following : | |
$(<mySelector>).removeCss(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Converter HTML to plain text like Gmail: | |
html = html.replace(/<style([\s\S]*?)<\/style>/gi, ''); | |
html = html.replace(/<script([\s\S]*?)<\/script>/gi, ''); | |
html = html.replace(/<\/div>/ig, '\n'); | |
html = html.replace(/<\/li>/ig, '\n'); | |
html = html.replace(/<li>/ig, ' * '); | |
html = html.replace(/<\/ul>/ig, '\n'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function htmlEntities (str) { | |
return String(str) | |
.replace(/&/g, '&') | |
.replace(/</g, '<') | |
.replace(/>/g, '>') | |
.replace(/"/g, '"'); | |
} | |
function toHtml(content) { |
NewerOlder