Skip to content

Instantly share code, notes, and snippets.

@sapphiriq
sapphiriq / gist:3610259
Created September 3, 2012 15:58 — forked from chrismatthieu/gist:964754
SIP Registrar with Tropo PSTN
// Run Redis - cd redis-2.2.4 and run src/redis-server
var sip = require('sip');
var sys = require('sys');
var redis = require('redis');
var tropoapi = require('tropo-webapi');
//Trim leading and trailing whitespace from string values.
function trim(str) {
return str.replace(/^\s+|\s+$/g, '');
@sapphiriq
sapphiriq / mysql.rb
Created July 23, 2012 10:38
Mysql Formula
require 'formula'
class Mysql < Formula
homepage 'http://dev.mysql.com/doc/refman/5.5/en/'
url 'http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.25a.tar.gz/from/http://cdn.mysql.com/'
version '5.5.25a'
sha1 '85dfea413a7d5d2733a40f9dd79cf2320302979f'
depends_on 'cmake' => :build
depends_on 'readline'

#Prerendering pages ( test ):

#Determine if your app is visible or not: document.addEventListener('visibilitychange', function(e) { console.log('hidden:' + document.hidden, 'state:' + document.visibilityState) }, false);

#http://davidwalsh.name/page-visibility

<!DOCTYPE html>
<html>
<head><title>kick test</title></head>
<body>
<img src="http://goo.gl/Hpra0" />
</body>
</html>
@sapphiriq
sapphiriq / gist:2268952
Created March 31, 2012 21:57
Rutor.org CSS
div#up, div#all h1 {
display: none;
}
div#all::before {
content: 'Rutor.org';
padding: 5px 15px;
display: block;
background: #222;
color: #666;
@sapphiriq
sapphiriq / rails_datamapper_template.rb
Created February 24, 2012 08:03
Rails Datamapper template
# inspired by http://www.rowtheboat.com/archives/32
# get all datamapper related gems (assume sqlite3 to be database)
gem "datamapper4rails"#, :require => 'datamapper4rails' # excuse the typo
gem "addressable", :require => "addressable/uri"
gem "do_sqlite3"
gem 'dm-validations'
gem 'dm-timestamps'
gem "rspec", :require => false
@sapphiriq
sapphiriq / ffmpeg on macosx
Created February 15, 2012 20:03
FFMPEG on mac os x installation (error free)
curl -O http://tools.rodrigopolo.com/bin/mac/binkit-v1.3.tar.gz
tar xzf binkit-v1.3.tar.gz
cd binkit-v1.3/
./install.sh
cd ..
rm -rf ./binkit-v1.3
rm binkit-v1.3.tar.gz
<?php
protected function display($template = FALSE, $render = TRUE)
{
if ($template == FALSE)
{
// Delete package namespaces (e.g., App\Controllers)
$name = strtolower(get_class($this));
$name = implode(DS,array_slice(explode('\\', $name), 2));