Skip to content

Instantly share code, notes, and snippets.

View sebastianhoitz's full-sized avatar
🎯
Focusing

Sebastian Hoitz sebastianhoitz

🎯
Focusing
View GitHub Profile
<?php
class Twitter_StreamingClient extends Twitter_Phirehose
{
const URL_BASE = 'http://stream.twitter.com/1/statuses/';
const METHOD_USER = 'user';
const CONNECT_OAUTH = 'oauth';
const CONNECT_BASIC = 'basic';
protected $status_length_base = 10; // for some reason, the userstream uses hexadecimal status lengths
class Foo
{
private int x;
public Foo(int x)
{
this.x = x;
}
public int add(Foo a)
@sebastianhoitz
sebastianhoitz / PostCode.php
Created May 13, 2011 21:41
Zend PostCode Validator dependent on Country
<?php
class My_Validate_PostCode extends Zend_Validate_Abstract
{
public function isValid($value, $context = null)
{
$value = (string) $value;
if(!(is_array($context) && isset($context['country'])))
{
/**
* Class Eieruhr
*
* Eigener Thread. Bekommt als Parameter Name und dauer als String.
* Gibt nach Ablaufen der Zeit aus, dass die Zutat fertig ist.
*/
class Eieruhr extends Thread
{
String time;
long startTimeMillis;
@sebastianhoitz
sebastianhoitz / gist:1348738
Created November 8, 2011 18:58
Hem + Less Bug
var hem = new (require('hem'));
var less = require('less');
var fs = require('fs');
var argv = process.argv.slice(2);
hem.compilers.less = function(path) {
var content, result;
content = fs.readFileSync(path, 'utf8');
result = '';
@sebastianhoitz
sebastianhoitz / gist:1401279
Created November 28, 2011 17:47
Zend Framework Auth plugin
<?php
class App_Controller_Plugin_Auth extends Zend_Controller_Plugin_Abstract
{
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
$auth = Zend_Auth::getInstance();
if (!$auth->hasIdentity()
&& !($request->getControllerName() == "session"
@sebastianhoitz
sebastianhoitz / gist:2007824
Created March 9, 2012 18:10
My Sublime Text 2 Key Bindings
[
// easy insert mode exiting
{ "keys": ["j", "j"], "command": "exit_insert_mode",
"context":
[
{ "key": "setting.command_mode", "operand": false },
{ "key": "setting.is_widget", "operand": false }
]
},
<?php
function buildSetString($arguments)
{
if (count($arguments) == 0)
{
return "";
}
$query = 'SET ';
prisma-cloud@0.0.1/Library/WebServer/Documents/prisma/prisma-cloud
├── async@0.1.22
├── chai@1.2.0
├─┬ cli-table@0.0.2
│ └── colors@0.3.0
├── coffee-resque@0.1.7
├── coffee-script@1.3.2
├─┬ coffeecup@0.3.11
│ └── optparse@1.0.3
├─┬ connect-redis@1.4.1
/Library/WebServer/Documents/prisma/prisma-cloud/node_modules/tower/packages/tower-application/server/application.coffee:100
return this._super.apply(this, arguments);
^
TypeError: Cannot call method 'apply' of undefined
at Application.Tower.Application.Application.init (/Library/WebServer/Documents/prisma/prisma-cloud/node_modules/tower/packages/tower-application/server/application.coffee:100:26)
at Application.Class (/Library/WebServer/Documents/prisma/prisma-cloud/node_modules/tower/node_modules/ember-runtime-node/index.js:3202:12)
at Application.Hook (/Library/WebServer/Documents/prisma/prisma-cloud/node_modules/tower/packages/tower-application/shared/hook.coffee:10:41)
at Application.Engine (/Library/WebServer/Documents/prisma/prisma-cloud/node_modules/tower/packages/tower-application/shared/engine.coffee:10:43)
at new Application (/Library/WebServer/Documents/prisma/prisma-cloud/node_modules/tower/packages/tower-application/server/application.coffee:21: