Skip to content

Instantly share code, notes, and snippets.

View vbugarsk's full-sized avatar

buggy09 vbugarsk

View GitHub Profile
@vbugarsk
vbugarsk / FBCore.php
Created May 8, 2012 04:21
Easy facebook component
<?php
#Facebook component
class FBCore extends CApplicationComponent {
//we want to use setters and getter for the public vars.
protected $_appId;
protected $_appSecret;
//this won't be set via config properties!
protected $_facebook;
@vbugarsk
vbugarsk / FacebookConnect.php
Created May 8, 2012 04:20
Facebook connect by CApplicationComponent
<?php
/**
* FacebookConnect class file.
* @author Christoffer Niska <ChristofferNiska@gmail.com>
* @copyright Copyright &copy; Christoffer Niska 2011-
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
*/
/**
* Facebook connection application component.
@vbugarsk
vbugarsk / controller.php
Created May 6, 2012 22:30
FB Yii connect without extension
<?php
public function actionFacebook()
{
$alias=Yii::getPathOfAlias('custom.components.facebook');
require($alias.DIRECTORY_SEPARATOR.'facebook.php');
$facebook = new Facebook(array(
'appId' => Yii::app()->settings->get('facebook','appId'),
'secret' => Yii::app()->settings->get('facebook','appSecret'),
));
@vbugarsk
vbugarsk / gmap-polyline
Created May 5, 2012 03:29
create google maps polyline from gpx file $_GET
$.ajax({
type: "GET",
url: "URL to the GPX file",
dataType: "xml",
success: function(xml) {
var points = [];
var bounds = new google.maps.LatLngBounds ();
$(xml).find("trkpt").each(function() {
var lat = $(this).attr("lat");
var lon = $(this).attr("lon");
@vbugarsk
vbugarsk / TRKParser.php
Created May 3, 2012 04:25
Parse GPX XML file
<?php
$doc = new DOMDocument();
$doc->load('TRKFile.gpx');
/* TRACK POINTS */
$trks = $doc->getElementsByTagName('trk');
foreach($trks as $trk)
{
$name = $trk->getElementsByTagName('name')->item(0)->nodeValue;
@vbugarsk
vbugarsk / view.php
Created May 2, 2012 21:30
view.php of route model
<?php
$this->breadcrumbs=array(
'Routes'=>array('index'),
$model->title,
);
$this->menu=array(
array('label'=>'List Route', 'url'=>array('index')),
array('label'=>'Create Route', 'url'=>array('create')),
array('label'=>'Update Route', 'url'=>array('update', 'id'=>$model->id)),