Skip to content

Instantly share code, notes, and snippets.

View petrabarus's full-sized avatar

Petra Barus petrabarus

View GitHub Profile
  1. General Background and Overview
$.each(UBMap.PropertyStore.markers, function(i, marker){
window.setTimeout(function() {
if (bounds.contains(marker.getPosition()) &&
($.inArray(marker.listingType, filter.fListing) > -1) &&
($.inArray(marker.propertyType, filter.fProperty) > -1) &&
UBMap.FilterForm.filterMarker(marker, module.moreFilterParams)){
count++;
marker.setVisible(true);
var item = UBMap.PropertyPanel.putItemList(i, marker);
module.attachLeftPaneEvent(item, marker);
/**
* In the config
*/
return [
'components' => [
'urlManager' => [
'rules' => [
//....
//let's assume 'view' is not eligible for a username :)
'member/<username:\w+>' => 'member/view',
<?php
/**
* @property-read CWidget $owner
* @method CWidget getOwner()
*/
class WidgetAssetBehavior extends CBehavior {
private static $_assetPaths;
<?php
abstract class CAssetWidget extends CWidget {
private static $_assetPaths;
/**
* @param boolean $checkTheme
* @return string
*/
<?php
$arrs = Array(
12 => array(
'model' => 'aksesoris',
'children' => array(
1716 => array(
'model' => 'jam_tangan',
),
1717 => array(
'model' => 'kacamata_lainnya',
@petrabarus
petrabarus / pixelbug.php
Created April 19, 2013 06:13
PHP 1x1px gif
<?php
header("Content-type: image/gif");
header("Content-length: 43");
header("Cache-control: private, no-cache, no-cache=Set-Cookie, proxy-revalidate");
header("Pragma: no-cache");
$fp = fopen("php://output", "wb");
fwrite($fp, "GIF89a\x01\x00\x01\x00\x80\x00\x00\xFF\xFF", 15);
fwrite($fp, "\xFF\x00\x00\x00\x21\xF9\x04\x01\x00\x00\x00\x00", 12);
fwrite($fp, "\x2C\x00\x00\x00\x00\x01\x00\x01\x00\x00\x02\x02", 12);
fwrite($fp, "\x44\x01\x00\x3B", 4);
<?php
/**
* ConfigLoader class file.
*
* @author Petra Barus <petra.barus@gmail.com>
* @package application.components
* @since 2013.02.15
*/
IPTABLES="$(which iptables)"
# RESET DEFAULT POLICIES
$IPTABLES -P INPUT ACCEPT
$IPTABLES -P FORWARD ACCEPT
$IPTABLES -P OUTPUT ACCEPT
$IPTABLES -t nat -P PREROUTING ACCEPT
$IPTABLES -t nat -P POSTROUTING ACCEPT
$IPTABLES -t nat -P OUTPUT ACCEPT
$IPTABLES -t mangle -P PREROUTING ACCEPT
@petrabarus
petrabarus / locations.php
Created September 4, 2013 09:56
Location list in Indonesia
<?php
array(
'Bali' => array(
'Badung' => array(
'Abiansemal',
'Kuta',
'Kuta Selatan',
'Kuta Utara',
'Mengwi',