Skip to content

Instantly share code, notes, and snippets.

View Djuki's full-sized avatar

Ivan Đurđevac Djuki

  • Freelancer
  • Serbia
  • 20:33 (UTC -12:00)
  • X @Djuki
View GitHub Profile
@Djuki
Djuki / 0_reuse_code.js
Created July 7, 2014 09:23
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@Djuki
Djuki / VideoThumbnail.php
Last active December 18, 2015 15:28
Create youtube image with play button and scrubber
<?php
/**
* Get image for video preview
*
* @param $videoId
*
* @return string
*/
public function createVideoImage($videoId)
@Djuki
Djuki / PingPong.java
Last active December 15, 2015 16:59
PingPong synchronization with main thread in several programming languages
class PingPongThread extends Thread {
/**
* Message for print
*/
private String message;
/**
* Main Application thread
*/
@Djuki
Djuki / menu_data_raw.php
Last active December 15, 2015 07:38
Proper way to print root menu items and child menu items in separated div's.
<?php
$menu = array(
0 => array('display' => 'Writers', 'url' => 'http://www.famousauthors.org/', 'sub' => array(
array('display' => ' Alan Moore', 'url' =>'http://www.famousauthors.org/alan-moore'),
array('display' => ' Dan Brown', 'url' =>'http://www.famousauthors.org/dan-brown'),
array('display' => ' Mario Puzo', 'url' =>'http://www.famousauthors.org/mario-puzo'),
)),
1 => array('display' => 'Musicians', 'url' => 'http://www.thefamouspeople.com/musicians.php', 'sub' => array(
array('display' => ' Composer', 'sub' => array(
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
$container = new ContainerBuilder();
$loader = new XmlFileLoader($container, new FileLocator(__DIR__));
$loader->load('services.xml');
@Djuki
Djuki / traktor2b.php
Created February 7, 2013 20:37
DI with setter method
class Tractor
{
protected $engine;
public function setEngine($engine)
{
$this->engine = $engine;
}
}
use DI\Annotations\Inject;
class Foo {
/**
* @Inject
* @var Bar
*/
private $bar;
public function __construct() {
@Djuki
Djuki / injection3.php
Last active December 9, 2015 23:48
Primer korišćenja IoC containera
<?php
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
class Engine
{
private $cubic;
/**
@Djuki
Djuki / injection2.php
Last active December 9, 2015 23:39
Primer korišćenja IoC containera uz setter metode
<?php
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
class Tractor
{
/**
* Engine
*
@Djuki
Djuki / injection1.php
Last active December 9, 2015 23:39
Primer korišćenja IoC containera
<?php
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
// Create IoC container
$container = new ContainerBuilder();
// Register Engine object and parameter for constructor
$container->register('my.engine', '\\Model\\Engine')