Skip to content

Instantly share code, notes, and snippets.

View jaytaph's full-sized avatar
:shipit:
Calculating pi

Joshua Thijssen jaytaph

:shipit:
Calculating pi
View GitHub Profile
@jaytaph
jaytaph / saffire.rst
Last active December 20, 2015 00:49
saffire datastructure subscriptions

Datastructures and subscriptions

A basic datastructure is defined as:

<datastructure>[<elementlist>]
  • The datastructure can be a data-structure class (something that implements the interface datastructure, or subscription or something?).
  • The element-list is a comma separated list of 0 or more elements.
import saffire;
import http::request;
import saffire::sapi;
class http {
protected property sapi = null;
public method detectSapi() {
switch (saffire.sapi()) {
case "fastcgi" :
/usr/share/saffire/modules
/usr/share/saffire/modules/sfl
/usr/share/saffire/modules/sfl/io.sf
/usr/share/saffire/modules/sfl/saffire.sf
/usr/share/saffire/modules/Framework.sf
/usr/share/saffire/modules/Framework
/usr/share/saffire/modules/Framework/View.sf
/usr/share/saffire/modules/Framework/Http.sf
diff --git a/src/components/compiler/saffire.y b/src/components/compiler/saffire.y
index 1d9ff12..06702b8 100644
--- a/src/components/compiler/saffire.y
+++ b/src/components/compiler/saffire.y
@@ -95,7 +95,7 @@
%token T_CATCH "catch" T_BREAK "break" T_GOTO "goto" T_BREAKELSE "breakelse"
%token T_CONTINUE "continue" T_THROW "throw" T_RETURN "return" T_FINALLY "finally"
%token T_TRY "try" T_DEFAULT "default" T_METHOD "method"
-%token T_SELF "self" T_PARENT "parent" T_NS_SEP T_TO
+%token T_SELF "self" T_PARENT "parent" T_NS_SEP "::" T_TO
namespace eval moin {
bind pubm -|- * moin::moin
}
proc moin::moin { nick host handle chan text } {
if {[regexp -nocase -- {(^moin|^mornin)} $text]} {
putserv "PRIVMSG $chan :$nick moin"
}
if {[regexp -nocase -- {(^:\)|^:P)} $text]} {
namespace eval moin {
bind pubm -|- * moin::moin
}
proc moin::moin { nick host handle chan text } {
if {[regexp -nocase -- {(^moin|^mornin)} $text]} {
putserv "PRIVMSG $chan :$nick moin"
}
}
@jaytaph
jaytaph / ini.php
Created May 10, 2013 14:09
simple php reader/writer
<?php
class MyIni {
protected $file;
protected $section_endings;
protected $keys;
function __construct($filename) {
$this->file = file($filename);
$this->_parse();
<?php
namespace Acme\DemoBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
* @ORM\Table(name="Foo", uniqueConstraints={
@ORM\UniqueConstraint(name="fullname",columns={"firstname", "lastname"}),
import io;
a = 1;
b = 2;
c = 3;
(a, , c) = (b, c, a)
io.printlf("A: ",a);
io.printlf("B: ",b);
import io;
class foo {
public method bar() {
io.print("Hi, this is ", self.__name(), ".bar\n");
}
}