Skip to content

Instantly share code, notes, and snippets.

namespace :blogify do
desc "Sync extra files from blogify plugin"
task :sync do
system "rsync -ruv vendor/plugins/blogify/db/migrate db"
end
end
# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.
class ApplicationController < ActionController::Base
helper :all # include all helpers, all the time
protect_from_forgery # See ActionController::RequestForgeryProtection for details
# Este layout tem precedência sobre a convenção do rails.
layout 'blog'
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 / gist:983268
Created May 20, 2011 16:26
Exemplo para criação de classe dinamica via(Alexandre Angelim)
class Pai
def self.mirrored_in(klass_name, &block)
klass = Class.new do
def bar
puts "bar"
end
end
klass.class_eval &block
Object.const_set klass_name, klass
end
@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 / tsv2mgdb.go
Last active September 27, 2015 17:28
Hard Coded Program to export the Output from Mysql TSV to MongoDB
package main
import (
"bufio"
"flag"
"os"
"strings"
"launchpad.net/gobson/bson"
"launchpad.net/mgo"
"bytes"
@marciol
marciol / raw_better-fifa-raquer.sh
Created November 24, 2011 17:17
raw_better-fifa-raquer
seq 1 1000000 | xargs -n1 -P100 -I{} curl -d "i_answer=1544512" http://pt.fifa.com/theclub/polls/pollId=1544769/staticvote.htmx
# Inspired by https://github.com/vquaiato/better-fifa-raquer
@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"
}