Random Logic Code

//Tambah key array dalam array php
 $comments = $this->comment->get_list($card_id);
 $presence = array();
 foreach ($comments as $key => $value) {
   $presence_user = ($this->account->get_presence($value['user_id'])?1:0);
   $comments[$key]['presence'] = $presence_user;

//hampir sama dengan fungsi file_exist yg ada di php
//tapi memanfaatkan ajax dan respon file not exist 404
//untuk dipakai di javascript dan multi domain (dan ada di server) 
function UrlExists(url)
   var http = new XMLHttpRequest();
   http.open('HEAD', url, false);
   return http.status!=404;
$.ajax({     url:'http://www.example.com/somefile.ext',     type:'HEAD',     error: function()     {         //file not exists     },     success: function()     {         //file exists     } });
$hot_cards = array();
foreach($result as $r) {
 $hot_cards[] = $r['card_id'];


ul.mambo /* ul that has class mambo*/
ul .mambo /* all element with class mambo with grandparent ul*/
/* all element with 
(class mambo AND class rambo AND id jumbo AND has attribute auooo)
with grandparent ul*/
  <li>Item 1</li>
      <li>Subitem 2A</li>
      <li>Subitem 2B</li>




ul li /*affect all li inside ul - get all 4 li in above example*/

Exact Descendant (don’t quite understand about it though)

ul * li /*affect second li inside ul*/


ul > li /*affect only one level li below ul - get only child of ul (2 li) in above example*/
<p>The selector above matches this paragraph.</p>
<p>The selector above does not match this paragraph.</p>

Adjacent Sibling

h2+p /*affect only the first p in above example*/

General Sibling

h2~p /*affect all p that in the same level as h2 in above example*/

Select user_id, count(komentar_id)
 from komentar
 group_by user_id

Javascript Parse string into int, isNumber

function parse(number){
 return parseInt(number.replace(/\D/g, ''), 10);
 function isNumber(n) {
 return !isNaN(parseFloat(n)) && isFinite(n);

Find duplicate entry MySQL

SELECT address, count(id) as cnt FROM list
GROUP BY address HAVING cnt > 1


Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout /  Ubah )

Foto Google

You are commenting using your Google account. Logout /  Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout /  Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout /  Ubah )

Connecting to %s