Skip to content

Instantly share code, notes, and snippets.

@dodyw
dodyw / function_category.php
Created September 27, 2011 22:56
indexu bug fix #18 Links Count Bug
function cat_build_stat($category_id) {
global $lep;
$children = cat_get_children($category_id);
$children[] = $category_id;
$children_str = implode(', ',$children);
$query = "select count(res_id) from lep_resource where category_id in ($children_str) and suspended = 0 and status = 1";
$num_res = $lep->db->GetOne($query);
@dodyw
dodyw / dir_stat.php
Created September 28, 2011 02:37
dir_stat widget update, fix link count
<?php
function w_dir_stat($option) {
global $lep;
$param = etc_read_option($option);
$query = "select count(res_id) as count from lep_resource where status = 1 and suspended = 0";
$active_links = $lep->db->GetOne($query);
$query = "select count(res_id) as count from lep_resource where status = 0";
@dodyw
dodyw / tes.js
Created November 4, 2011 08:09
hide select bila 'atasnya' kosong
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script type="text/javascript">
$(function() {
if($('select[name=add_cat1] option:selected').val()==0 &&
$('select[name=add_cat2] option:selected').val()==0 &&
$('select[name=add_cat3] option:selected').val()==0 &&
$('select[name=add_cat4] option:selected').val()==0 &&
$('select[name=add_cat5] option:selected').val()==0 &&
$('select[name=add_cat6] option:selected').val()==0 &&
$('select[name=add_cat7] option:selected').val()==0 &&
@dodyw
dodyw / config.js
Created December 23, 2011 22:08
WpApp configuration file
var config = {
/**************** app setting ****************/
// wordpress url
"BLOG_URL" : "http://www.dodyrw.com/wpappdemo/",
// webmaster email
"WEBMASTER_EMAIL" : "webmaster@domain.com",
@dodyw
dodyw / app.js
Created December 30, 2011 12:29 — forked from dawsontoth/app.js
Rate my app in Appcelerator Titanium Mobile
/**
* The following snippet will ask the user to rate your app the second time they launch it.
* It lets the user rate it now, "Remind Me Later" or never rate the app.
*/
var win = Ti.UI.createWindow({ backgroundColor: '#fff' });
win.addEventListener('open', checkReminderToRate);
win.add(Ti.UI.createLabel({ text: 'This is a simple app that will remind you to rate it.' }));
win.open();
function checkReminderToRate() {
@dodyw
dodyw / gist:1580339
Created January 9, 2012 00:56
Smart modem setting
Dial number: #777
Username : smart
Password : smart
@dodyw
dodyw / googlemap.html
Created January 14, 2012 01:18
google map v3 start code
<html>
<head>
<style type="text/css">
div#map{ width:750px; height:500px; }
</style>
</head>
<body>
<div id="map"></div>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>
<script type="text/javascript">
@dodyw
dodyw / geocode.php
Created January 14, 2012 10:20
geocode with google api v3
<?php
$address = "Sutorejo Utara, Surabaya, Indonesia";
$address = urlencode($address);
$url = "http://maps.googleapis.com/maps/api/geocode/json?address=$address&sensor=false";
$raw = file_get_contents($url);
$data = json_decode($raw);
$lat = $data->results[0]->geometry->location->lat;
$lng = $data->results[0]->geometry->location->lng;
git clone remotegitrepository
git init
git add foldername
git branch branchname
git checkout fileorbranchname
git remote add remotegitrepository
git add foldername