Skip to content

Instantly share code, notes, and snippets.

View indeyets's full-sized avatar

Alexey Zakhlestin indeyets

View GitHub Profile
import inspect
import gi
from gi.repository import Midgard
Midgard.init()
for name, obj in inspect.getmembers(Midgard):
if inspect.isclass(obj):
print(obj.__name__)
from gi.repository import Midgard
class RdfMapper:
def __init__(self):
self.read_types()
def read_types(self):
for gtype in Midgard.Object.__gtype__.children:
self.read_type(gtype)
from gi.repository import Midgard
class RdfMapper:
def __init__(self, mgd):
self.mgd = mgd
self.read_types()
def read_types(self):
for gtype in Midgard.Object.__gtype__.children:
self.read_type(gtype)
@indeyets
indeyets / php-github.php
Created March 24, 2011 12:27
GitHub OAuth + API test
<?php
class GitHubAuth
{
const AUTH_URL = 'https://github.com/login/oauth/authorize';
const ACCESS_TOKEN_URL = 'https://github.com/login/oauth/access_token';
private $app_id;
private $app_secret;
<?php
/**
* Mimics ant pattern matching.
* New addition (afaict): any pattern ending in '/' will only match directories
* @see http://ant.apache.org/manual/dirtasks.html#patterns
* @todo more complete testing
*/
function pake_antpattern($files, $rootdir)
{
$results = array();
@indeyets
indeyets / rdf-types.yaml
Created March 14, 2012 12:48
RDF Types hierarchy (based on XQuery, XPath specifications)
data_types: # child-values can be used "as-is" if parent-type is requested
"xs:anyType":
"xs:untyped": {}
"xs:anySimpleType":
"xs:anyAtomicType":
"xs:untypedAtomic": {}
"xs:dateTime": {}
"xs:date": {}
"xs:time": {}
"xs:duration":
@indeyets
indeyets / calendar.html
Created November 17, 2012 12:37
Календарь зоны действия
<iframe src="https://www.google.com/calendar/embed?showCalendars=0&amp;showTz=0&amp;mode=AGENDA&amp;height=500&amp;wkst=2&amp;hl=ru&amp;bgcolor=%23FFFFFF&amp;src=9ir9pkisi285laj0buv9r3caug%40group.calendar.google.com&amp;color=%23B1440E&amp;ctz=Europe%2FMoscow" style=" border-width:0 " width="650" height="500" frameborder="0" scrolling="no"></iframe>
@indeyets
indeyets / query.sparql
Last active December 21, 2015 04:19
SPARQL. Resource pagination example. This will return 10 first resources
CONSTRUCT {
?s ?p ?o
}
where {
?s ?p ?o .
{
select distinct ?s where {?s [] []} limit 10
}
}
<?php
namespace GridsBy\SPARQL\GraphStore;
use Guzzle\Http\Client;
class Connection
{
private $endpoint = '';
private $client = null;
@indeyets
indeyets / appserver.php
Created March 7, 2014 19:49
Example of simple PHP application conversion to use https://github.com/indeyets/appserver-in-php
<?php
/**************************
* aip variant of php file
**************************/
class MyApp
{
public function __invoke($context)
{
$output = '<h1>Hello world</h1>';