Skip to content

Instantly share code, notes, and snippets.

View thelinuxlich's full-sized avatar
🐉
Here be dragons

Alisson Cavalcante Agiani thelinuxlich

🐉
Here be dragons
View GitHub Profile
We couldn’t find that file to show.
# no ApplicationHelper...
def toolbar(module_name,id,options={})
acesso_geral = current_usuario.send("may_gerenciar_#{module_name}?")
acesso_edit = current_usuario.special_permissions.updatable(module_name).exists?
acesso_read = current_usuario.special_permissions.readable(module_name).exists?
acesso_delete = current_usuario.special_permissions.deletable(module_name).exists?
concat("<span class='toolbar'>")
if(acesso_geral || acesso_edit) && (options[:actions].include?(:edit))
concat(link_toolbar(module_name,id,"edit","Editar"))
end
!!! Strict
%html{html_attrs}
%head
%title
= h(yield(:title) || "..:: Daiwa Isenções ::..")
%meta{"http-equiv"=>"Content-Type", :content=>"text/html; charset=utf-8"}/
= stylesheet_link_tag 'application'
= stylesheet_link_tag 'formtastic'
= stylesheet_link_tag 'redmond/jquery-ui-1.8rc3.custom.css'
= stylesheet_link_tag 'demo_table_jui.css'
def datatable_ajax(modelo,opcoes={})
options = {:limit => params[:iDisplayLength], :offset => params[:iDisplayStart], :order => [], :include => []}
conditions = []
tabela_pai = modelo.to_s.tableize
@ordem = criar_array_de_ordenacao
opcoes[:campos].each_with_index do |v,i|
if @ordem.include?(i.to_s)
options[:order] << formatar_campo_ordem(tabela_pai,v,params["sSortDir_#{@ordem.index(i.to_s)}"])
end
includes = include_tabela_campo(v)
require 'benchmark'
require 'sexpistol'
require 'sxp'
require 'strscan'
class Lexer < StringScanner
def next_token
# Housekeeping.
skip /\s*/
# URL do sistema
URL = "http://#{window.location.host}/aplic/eventos_internos"
# Classe que contém o comportamento geral do sistema.
VM =
loading: KO false
evento: KO new Evento()
tipos_de_evento: ['CURSO','PALESTRA','FEIRA','JORNADA','SEMINÁRIO','CONGRESSO','WORKSHOP','OUTROS']
cursos: KO []
estados: KO []
cidades: KO []
/** URL do sistema */
var URL = "http://"+window.location.host+"/aplic/eventos_internos";
/**
* Classe que contém o comportamento geral do sistema.
* @name VM
* @class
*/
var VM = {
loading: KO(false),
evento: KO(new Evento()),
@thelinuxlich
thelinuxlich / coffee_watcher
Created February 8, 2011 18:55
This shellscript watches coffee files for changes and compiles them and runs docco after
#!/bin/sh
# use my inotify-tools fork at https://github.com/thelinuxlich/inotify-tools
# use my docco fork if you want to generate php documentation(npm install thelinuxlich-docco)
while output=`inotifywait -r -e create -e close_write -e modify --format '%w %f' --include ".*\.(coffee|php)$" /srv/www/htdocs/php/`; do
DIR=${output%% *}
DOCDIR=${DIR/php\//php\/docs/}
FILE=${output#* }
echo "Detected a change in ${DIR}${FILE} ..." >> /srv/www/htdocs/php/logs/watcher.log
if [[ $FILE == *.coffee* ]]
then
# Modelo do evento para persistência no banco de dados.
class @Evento
constructor: ->
@descricao.subscribe ((value) ->
if value.length > 4000
@descricao value.substr(0, 4000)
).bind @
@tipo.subscribe ((value) ->
if value isnt "OUTROS"
@outro_tipo ""
VM =
evento: KO new Evento()