Skip to content

Instantly share code, notes, and snippets.

@xeoncross
xeoncross / view.__get.php
Last active October 1, 2015 11:57
View Error Handling For Missing Values
<?php
// Sets the error handler to check the current class for the value if it's missing
// http://stackoverflow.com/a/2669273/99923
error_reporting(E_ALL);
ini_set("display_errors", 0);
class View {
function display($file, $values)
{
@ziadoz
ziadoz / awesome-php.md
Last active May 8, 2025 07:37
Awesome PHP — A curated list of amazingly awesome PHP libraries, resources and shiny things.
@rkh
rkh / chat.rb
Created December 14, 2011 12:55
Simple Chat Application using the Sinatra Streaming API
# coding: utf-8
require 'sinatra'
set server: 'thin', connections: []
get '/' do
halt erb(:login) unless params[:user]
erb :chat, locals: { user: params[:user].gsub(/\W/, '') }
end
get '/stream', provides: 'text/event-stream' do
@xeoncross
xeoncross / run.php
Created August 30, 2011 01:45 — forked from greut/run.php
A web server in pure PHP (non-concurrent and concurrent)
#!/usr/bin/env php
<?php
$app = function($request) {
$body = <<<EOS
<!DOCTYPE html>
<html>
<meta charset=utf-8>
<title>Hello World!</title>