Skip to content

Instantly share code, notes, and snippets.

@markomarkovic
markomarkovic / belgrade_flight_schedule.php
Created February 8, 2011 15:51
Quick'n'Dirty CakePHP Model for fetching and parsing Belgrade airport flight schedule RSS
<?php
class BelgradeFlightSchedule extends AppModel {
var $useTable = false;
var $name = 'BelgradeFlightSchedule';
var $arrivalsURL = 'http://www.beg.aero/rss/time_table_arrivals.php?versionId=1&type=IA';
var $departuresURL = 'http://www.beg.aero/rss/time_table_departures.php?versionId=1&type=ID';
function find($conditions = null, $fields = array(), $order = null, $recursive = null) {
Cache::config('flight_schedule', array('engine' => 'File', 'duration' => '10 minutes'));
$schedule = Cache::read('flight_schedule');
@markomarkovic
markomarkovic / compile_PHPUnit-3.5.15.sh
Created November 2, 2011 02:26
A script to compile PHPUnit-3.5.15 with all dependencies into archive which can be extracted to CakePHP 2.0 Vendor directory in order to UnitTest cake (if you don't have access to PEAR commands or PEAR insists on installing PHPUnit-3.6.0 and not working).
#!/bin/sh
# Creating temp dirs
mkdir .compile_PHPUnit_$$
cd .compile_PHPUnit_$$
# Fetching the archives
wget -nv http://pear.phpunit.de/get/PHPUnit-3.5.15.tgz
wget -nv http://pear.phpunit.de/get/DbUnit-1.0.0.tgz
wget -nv http://pear.phpunit.de/get/File_Iterator-1.2.3.tgz
@markomarkovic
markomarkovic / paging.ctp
Created October 25, 2012 11:39 — forked from justinyost/paging.ctp
Paging Element for Twitter Bootstrap and CakePHP 2.0+
<?php $span = isset($span) ? $span : 8; ?>
<?php $page = isset($this->request->params['named']['page']) ? $this->request->params['named']['page'] : 1; ?>
<?php $pages = (int)$this->Paginator->counter('{:pages}'); ?>
<div class="pagination pagination-centered">
<ul>
<?php echo $this->Paginator->prev(
'&larr; ' . __('Previous'),
array(
'escape' => false,
'tag' => 'li'
#!/usr/bin/env bash
# Uses GraphicsMagick to stich together all images in a folder and
# generates a CSS file with the correct offsets along with a
# test HTML page for verification
if [ $# -gt 0 ]
then
if [ $3 ]
@markomarkovic
markomarkovic / switch-desktop-background
Last active August 29, 2015 14:14
Automatically switch desktop background to latest Bing image
#!/usr/bin/env bash
# Fetches the latest Bing image and sets it as desktop background
#
# Requirements:
# curl, jq, nitrogen, convert (imagemagick)
#
# Installation:
# sudo cp switch-desktop-background /usr/local/bin/
# sudo chmod +x /usr/local/bin/switch-desktop-background

Keybase proof

I hereby claim:

  • I am markomarkovic on github.
  • I am markomarkovic (https://keybase.io/markomarkovic) on keybase.
  • I have a public key ASAe5YSZbzVN3R_GUc3i5N51pDulf0M4N8wvQT1eZ6sAQQo

To claim this, I am signing this object: