Skip to content

Instantly share code, notes, and snippets.

View joseph-montanez's full-sized avatar

Joseph Montanez joseph-montanez

View GitHub Profile
@joseph-montanez
joseph-montanez / pent.php
Created August 3, 2011 15:57
Possible coment style chat?
<?php
$socket = stream_socket_server ('tcp://0.0.0.0:2000', $errno, $errstr);
stream_set_blocking($socket, 0);
$base = event_base_new();
$event = event_new();
event_set($event, $socket, EV_READ | EV_PERSIST, 'ev_accept', $base);
event_base_set($event, $base);
event_add($event);
event_base_loop($base);
@joseph-montanez
joseph-montanez / ws_cb.adb
Created August 5, 2011 02:33
Never returns anything
------------------------------------------------------------------------------
-- Ada Web Server --
-- --
-- Copyright (C) 2000-2009, AdaCore --
-- --
-- This library is free software; you can redistribute it and/or modify --
-- it under the terms of the GNU General Public License as published by --
-- the Free Software Foundation; either version 2 of the License, or (at --
-- your option) any later version. --
-- --
ghc -XPackageImports pong.hs
@joseph-montanez
joseph-montanez / Makefile
Created August 20, 2011 03:12
XPath Compiling Issues?
all:
valac --version
valac --vapidir=vapi --pkg libsoup-2.4 --pkg libxml-2.0 --thread -g --save-temps main.vala
./main
@joseph-montanez
joseph-montanez / instant_notice.php
Created October 24, 2011 20:40
Connecting to nodejs
<?php
class instant_notice {
public $sid = '';
public $host = 'example.com';
public $port = '1337';
public function connect() {
//----------------------------------------------------------------
//-- Get Handshack
//----------------------------------------------------------------
$opts = array('http' =>
program console;
{$mode objfpc}{$H+}
uses
sysutils, pango, Glib2, Gdk2, Gtk2;
procedure Shabb_Print (Line : String);
begin
@joseph-montanez
joseph-montanez / Makefile
Created February 20, 2012 18:11
libpurple vala example, take from a c version
all:
valac --thread --save-temps -g --pkg purple app.vala
@joseph-montanez
joseph-montanez / Page.asp
Created March 1, 2012 10:28
ASP Classic example of REST / JSON call
<%@ Language="VBScript" %>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<!--#include file="json.asp"-->
<%
@joseph-montanez
joseph-montanez / json.asp
Created March 2, 2012 08:52
A basic jsonrpc server and client. The client is in ASP and the server is in PHP
<script language="JScript" runat="server">
var JSON;
if (!JSON) {
JSON = {};
}
(function () {
'use strict';
function f(n) {
@joseph-montanez
joseph-montanez / README.md
Created March 4, 2012 01:37
JSON-RPC server in PHP

== JSON-RPC ==

This is designed to have to autoload calls and return a json object. It supports PHP 5.3's namespaces, and relies on PHP's built in Reflection.

Example: htttp://localhost/rpc.php?0={"method":"foo\myclass::hello","params":[], "id":2}

Returns: {"result":"Hello World","error":null,"id":2}