Skip to content

Instantly share code, notes, and snippets.

require 'action_view'
require 'active_support'
require 'mustache'
class Mustache
# TODO - Think about allowing to overwrite layout methods in subclassing views
#
# http://github.com/defunkt/mustache/blob/master/lib/mustache/sinatra.rb#L79-82
# http://github.com/defunkt/mustache/blob/master/lib/mustache/sinatra.rb#L96-102
@marciol
marciol / default
Created August 10, 2011 16:58 — forked from mauricio/default
# as we’re going to use Unicorn as the application server
# we’re not going to use common sockets
# but Unix sockets for faster communication
upstream shop {
# fail_timeout=0 means we always retry an upstream even if it failed
# to return a good HTTP response (in case the Unicorn master nukes a
# single worker for timing out).
# for UNIX domain socket setups:
server unix:/tmp/shop.socket fail_timeout=0;
@marciol
marciol / fibonacci.lua
Created August 29, 2011 14:48 — forked from nrk/fibonacci.lua
Mercury + Haml: generating fibonacci numbers
require 'luarocks.require'
require 'mercury'
require 'haml'
module('fibonacci', package.seeall, mercury.application)
local templates = {
index = [[
%html
%head
@marciol
marciol / GenImage.scala
Created February 7, 2012 20:47 — forked from zentrope/GenImage.scala
PNG on-the-fly image generation
import java.io.File
import javax.imageio.ImageIO
import java.awt.image.BufferedImage
import java.awt.geom._
import java.awt.Color
import java.awt.Font
import java.awt.Graphics2D
import java.util.Date
@marciol
marciol / main.cpp
Created March 6, 2012 03:49 — forked from arch-jslin/main.cpp
Simple C++ class in a main executable, see if luajit ffi should be able to resolve symbols.
#include <cstdio>
#include <cstdlib>
extern "C" {
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
#include "luajit.h"
}
require "orbit"
require "orbit.routes"
local R = orbit.routes.R
local hello = orbit.new()
hello:dispatch_get(function (web)
return string.format('<h1>Welcome to %s!</h1>', web.real_path)
@marciol
marciol / Hello.fs
Created May 7, 2012 00:35 — forked from mythz/Hello.fs
Stand-alone Hello World ServiceStack Web Service with F# on Mono/OSX hosted by HttpListener
(* Stand-alone Hello World ServiceStack Web Service with F# on Mono/OSX hosted by HttpListener
Instructions:
1) download https://github.com/ServiceStack/ServiceStack/downloads
2) fsharpc -r:ServiceStack.Common.dll -r:ServiceStack.Interfaces.dll -r:ServiceStack.Text.dll -r:ServiceStack.dll Hello.fs
3) sudo mono Hello.exe
Read More: For the benefits of a ServiceStack Hello World Service see: http://www.servicestack.net/ServiceStack.Hello/
*)
@marciol
marciol / FsVersion.fs
Created May 17, 2012 17:05 — forked from rojepp/FsVersion.fs
F# Translation for Miguel. I have no idea if this works, and it is pretty much a verbatim translation, only some F# flare added. I didn't dare to do too much refactoring without having a way to test properly. Original: https://github.com/xamarin/monotouch
namespace GLCameraRipple
open System
open System.Drawing
open System.Runtime.InteropServices
//open MonoTouch.CoreFoundation
open Microsoft.FSharp.NativeInterop
type RippleModel(screenSize : Size, meshFactor: int, touchRadius: int, textureSize: Size) =
do Console.WriteLine ("New RippleModel");
let poolWidth = screenSize.Width / meshFactor
@marciol
marciol / FSharpSerialization.fsx
Created October 16, 2012 04:03 — forked from theburningmonk/FSharpSerialization.fsx
Serializing/Deserializing F# Record and DU types
#r "System.Xml.dll"
#r "System.Runtime.Serialization.dll"
open Microsoft.FSharp.Reflection
open System.IO
open System.Reflection
open System.Runtime.Serialization
open System.Runtime.Serialization.Formatters.Binary
open System.Runtime.Serialization.Json
open System.Text
@marciol
marciol / Shell.fs
Created December 20, 2012 20:55 — forked from dvdsgl/Shell.fs
// Demo:
//
// let files = sh "ls -a /Users/david" |> lines
// let install = sh "cp -r %s /Applications"
// install "/Volumes/Awareness/Awareness.app"
//
module Campari.Shell
open System