Skip to content

Instantly share code, notes, and snippets.

View mauriciodarocha's full-sized avatar

Mauricio Rocha mauriciodarocha

View GitHub Profile
'use strict';
// Add ECMA262-5 method binding if not supported natively
//
if (!('bind' in Function.prototype)) {
Function.prototype.bind= function(owner) {
var that= this;
if (arguments.length<=1) {
return function() {
return that.apply(owner, arguments);
@mauriciodarocha
mauriciodarocha / MetaObject.php
Created May 30, 2016 23:27 — forked from CHH/MetaObject.php
PHP does Meta Programming too! (Requires PHP 5.4)
<?php
namespace CHH;
trait MetaObject
{
protected static $__metaClass;
static function setMetaClass(MetaClass $metaClass)
{
@mauriciodarocha
mauriciodarocha / dummy-web-server.py
Created September 16, 2016 02:28 — forked from bradmontgomery/dummy-web-server.py
a minimal http server in python. Responds to GET, HEAD, POST requests, but will fail on anything else.
#!/usr/bin/env python
"""
Very simple HTTP server in python.
Usage::
./dummy-web-server.py [<port>]
Send a GET request::
curl http://localhost
@mauriciodarocha
mauriciodarocha / HttpServer.cs
Created May 29, 2023 20:12 — forked from define-private-public/HttpServer.cs
A Simple HTTP server in C#
// Filename: HttpServer.cs
// Author: Benjamin N. Summerton <define-private-public>
// License: Unlicense (http://unlicense.org/)
using System;
using System.IO;
using System.Text;
using System.Net;
using System.Threading.Tasks;