Skip to content

Instantly share code, notes, and snippets.

View chrismatthieu's full-sized avatar
🚀
Hacking the metaverse!

Chris Matthieu chrismatthieu

🚀
Hacking the metaverse!
View GitHub Profile
@mr-rock
mr-rock / sinatra_jquery_test.rb
Created October 9, 2009 11:40
An example of Sinatra working with Ajaxified JQuery based on some pieces of code published by Rafael George on the Sinatra Google Group.
require 'sinatra'
require 'dm-core'
require 'haml'
DataMapper.setup(:default, 'sqlite3::memory:')
class Message
include DataMapper::Resource
property :id, Serial
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active February 20, 2025 22:23
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@lclarkmichalek
lclarkmichalek / gist:716164
Created November 26, 2010 01:35
In defence of Marak Squires
In recent days (the last 12-24 hours), there have been a couple of posts on a one
'Marak Squires', who goes by the tag JimBastard. He stands accused of stealing code,
and being a general douchebag. Stealing code isn't good. Being a douchebag isn't
acutally illegal. However, the way that the campaign against him has been carried
out worries me.
The post to reddit that brought this issue to attention was entitled 'Code Thief at
Large: Marak Squires / JimBastard'. It can be found here:
http://www.reddit.com/r/programming/comments/ebge2/code_thief_at_large_marak_squires_jimbastard/.
It was a link to a github gist that can be found here:
@mheadd
mheadd / right-way.js
Created December 20, 2010 22:05
Moving from blocking functional programming, to non-blocking Node.js programming.
var sys = require('sys');
var http = require('http');
var EventEmitter = require('events').EventEmitter;
TropoSession = function() {
this.responseBody;
};
TropoSession.prototype = new EventEmitter;
@ry
ry / https-hello-world.js
Created January 4, 2011 00:03
new node https api
// curl -k https://localhost:8000/
var https = require('https');
var fs = require('fs');
var options = {
key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),
cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem')
};
https.createServer(options, function (req, res) {
@chrismatthieu
chrismatthieu / Phono Example
Created April 4, 2011 15:30
phono 0.2 template
<html>
<head>
<script src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
<script src="http://s.phono.com/releases/0.2/jquery.phono.js"></script>
</head>
<body>
<input id="call" type="button" disabled="true" value="Loading..." />
<div id="pickupbutton" style="display:none"><input id="pickup" type="button" value="pickup" /></div>
<div id="hangupbutton" style="display:none"><input id="hangup" type="button" value="hangup" /></div>
@mheadd
mheadd / registrar.js
Created April 6, 2011 18:26
A simple SIP registrar that uses Node.js and Redis
var sip = require('sip');
var sys = require('sys');
var redis = require('redis');
//Trim leading and trailing whitespace from string values.
function trim(str) {
return str.replace(/^\s+|\s+$/g, '');
}
sip.start({},function(request) {
@chrismatthieu
chrismatthieu / registrar.js
Created April 10, 2011 04:25 — forked from mheadd/registrar.js
Node.JS SIP Registrar
var sip = require('sip');
var sys = require('sys');
var redis = require('redis');
//Trim leading and trailing whitespace from string values.
function trim(str) {
return str.replace(/^\s+|\s+$/g, '');
}
sip.start({},function(request) {
@chrismatthieu
chrismatthieu / gist:966727
Created May 11, 2011 15:53 — forked from aaronpk/gist:966720
Email beta signup form saved to Google Docs
<!-- Put this in a file called post.php -->
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://spreadsheets.google.com/formResponse?formkey=your-google-form-key');
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(array(
'entry.0.single' => date('Y-m-d H:i:s'),
'entry.1.single' => $_POST['email'],
'entry.2.single' => $ref,
@chrismatthieu
chrismatthieu / weight.xml
Created August 2, 2011 00:36 — forked from mheadd/weight.xml
SRGS grammar in XML format for capturing weight information.
<?xml version="1.0" encoding="ISO-8859-1"?>
<grammar xmlns="http://www.w3.org/2001/06/grammar" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/2001/06/grammar http://www.w3.org/TR/speech-grammar/grammar.xsd"
version="1.0" xml:lang="en-US" mode="voice" root="main">
<!-- Main gramar rule -->
<rule id="main" scope="public">
<item>
<ruleref uri="#first" />
</item>