Skip to content

Instantly share code, notes, and snippets.

View squidge's full-sized avatar

Francisco Ruiz A squidge

View GitHub Profile
@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) {
@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 / 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 / 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: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:5675967
Created May 30, 2013 06:03
mongodm models
class Base extends Model {
static $config = "default";
}
class User extends Base {
static $collection = "user";
protected static $attrs = array(
'first_name' => array( 'type' => 'string' ),
'last_name' => array( 'type' => 'string' ),
@squidge
squidge / SublimeTextSettings
Last active December 22, 2015 02:59
ST3 settings
{
"close_windows_when_empty": true,
"color_scheme": "Packages/daylerees-themes/Laravel.tmTheme",
"draw_indent_guides": false,
"font_face": "Source Code Pro",
"font_options":
[
"subpixel_antialias"
],
"font_size": 15.0,
@squidge
squidge / mg.rb
Last active December 25, 2015 09:09
Ruby and Mongoid
require 'mongoid'
Mongoid.load!("mongoid.yml", environment = "development")
class Artist
include Mongoid::Document
field :name, type: String
embeds_many :instruments
end
@squidge
squidge / node-request-cheerio.js
Last active August 29, 2015 13:57
node-request-cheerio
request('https://news.ycombinator.com', function (error, response, html) {
console.log(response);
if (!error && response.statusCode == 200) {
var $ = cheerio.load(html);
$('span.comhead').each(function(i, element){
var a = $(this).prev();
console.log(a.text());
});
}
});
@squidge
squidge / Gruntfile.js
Created April 4, 2014 21:15
Grunt-Protractor-task
module.exports = function(grunt) {
grunt.initConfig({
protractor_webdriver: {
local: {
options: {
path: '',
command: 'webdriver-manager start',
},
},