Skip to content

Instantly share code, notes, and snippets.

Avatar

Márk Sági-Kazár sagikazarmark

View GitHub Profile
View screensaver.py
#!/usr/bin/python
# -*- coding: UTF-8 -*-
from gi.repository import Gio
import sys
import appindicator
import gtk
class Screensaver:
def __init__(self):
@sagikazarmark
sagikazarmark / Emitter
Last active Aug 29, 2015
Event Interop Interfaces
View Emitter
# Emitter/Dispatcher
This object is responsible for emitting/dispatching events to the listeners.
An Emitter can:
* Add listeners to the stack
* Return listeners (all, or the ones for a specific event)
* Remove listeners
* Emit an event
View task.php
<?php
class Task implements TaskInterface
{
public function run()
{
// ... some basic logic
// emit is just an example, the command logic is important here
$result = $this->emit(new InputCommand('Please give me some input!'));
@sagikazarmark
sagikazarmark / ObjectStorageTest.php
Created Jan 2, 2015
Tests that the object storage dereferences objects stored
View ObjectStorageTest.php
<?php
class foo
{
public function __destruct()
{
echo 'Destructor called';
}
}
View SomeServiceProvider.php
<?php
class SomeServiceProvider
{
public $provides = array(
'service',
'service.one',
'service.two',
);
@sagikazarmark
sagikazarmark / DbadException.php
Created Jan 30, 2015
In cases when your code is clearly not used for what it should be
View DbadException.php
<?php
/**
* DBAD exception
*
* @link http://www.dbad-license.org/
*/
class DbadException extends \Exception
{
@sagikazarmark
sagikazarmark / phpserver.php
Created Apr 14, 2015
PHP server router script
View phpserver.php
<?php
/**
* PHP Server router script
*/
// determine the file we're loading, we need to strip the query string for that
if (isset($_SERVER['SCRIPT_NAME']))
{
$file = $_SERVER['DOCUMENT_ROOT'].$_SERVER['SCRIPT_NAME'];
@sagikazarmark
sagikazarmark / package.gulp.json
Last active Aug 29, 2015
How not to use bower/grunt/gulp at all?
View package.gulp.json
{
"private": true,
"devDependencies": {
"bootstrap": "3.3.5",
"bootswatch": "3.3.5",
"browser-sync": "^2.8.0",
"browserify": "^11.0.0",
"del": "^1.1.1",
"domready": "^1.0.8",
"font-awesome": "4.3",
@sagikazarmark
sagikazarmark / sitemap_generators.md
Created Oct 13, 2015
List of currently available sitemap generators (and why they should be avoided)
View gist:9e8d2473e64a6fde9fa8
Verifying that +sagikazarmark is my blockchain ID. https://onename.com/sagikazarmark
You can’t perform that action at this time.