Skip to content

Instantly share code, notes, and snippets.

View squidge's full-sized avatar

Francisco Ruiz A squidge

View GitHub Profile
@squidge
squidge / gist:5229573
Created March 23, 2013 22:27
tests.watchr
ENV["WATCHR"] = "1"
system 'clear'
def growl(message)
growlnotify = `which growlnotify`.chomp
title = "Watchr Test Results"
image = message.include?('0 failures, 0 errors') ? "~/.watchr_images/passed.png" : "~/.watchr_images/failed.png"
options = "-w -n Watchr --image '#{File.expand_path(image)}' -m '#{message}' '#{title}'"
system %(#{growlnotify} #{options} &)
end
@squidge
squidge / gist:4773630
Last active December 12, 2015 12:39
Cache class. Uses Memcache as key/value store
<?php
class CacheStore
{
const MEMCACHE = 'Memcache';
static private $servers = NULL;
static function setServer($type, $server, $port) {
if (class_exists(self::MEMCACHE)) {
if (self::$servers[$type] != NULL) {
@squidge
squidge / gist:4773560
Last active December 12, 2015 12:38
compiling .net and running unit tests with rake
require 'rubygems'
require 'albacore'
require 'rake/clean'
CONFIGURATION = 'Release'
BUILD_DIR = File.expand_path('binaries/')
XUNIT_COMMAND = 'xunit/xunitmono.sh'
CLEAN.include(FileList[File.join(BUILD_DIR, '*')])
desc "Compiles solution"
@squidge
squidge / downloadfilemodel
Created November 18, 2011 13:18
Download file in FubuMVC
namespace DownloadStream.Controllers
{
using System.Web;
using FubuMVC.Core.Behaviors;
public class JpegController
{
public DownloadFileModel Stream()
{
return new DownloadFileModel
@squidge
squidge / LogOn.spark
Created November 8, 2011 16:16
How to use AjaxContinuation in FubuMVC
<script>
$(document).ready(function() {
$("#btnSubmit").click(function(e) {
e.preventDefault();
$.ajax({
type: "POST",
dataType: "json",
url: "log-on",
data: $("#logonForm").serialize(),
success: function (response) {