This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module BootstrapHelper | |
ALERT_TYPES = [:success, :info, :warning, :danger] | |
def glyph(icon) | |
content_tag :span, nil, class: "glyphicon glyphicon-#{icon}" | |
end | |
def bootstrap_tags_from_flash | |
content_tag :div, id: ApplicationHelper::FLASH_MESSAGES_TAG_ID do | |
flash.each do |type, message| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Edit Query. Adicionar abaixo de: | |
-- AND | |
-- V.DT_CANCELAMENTO IS NULL | |
-- A seguinte SQL: | |
AND | |
DATEADD(-3 HOUR TO DT_EMISSAO) BETWEEN :DT_INICIO | |
AND DATEADD(1 DAY TO :DT_FIM) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ActiveRecord::Base | |
# Does a left join through an association. Usage: | |
# | |
# Book.left_join(:category) | |
# # SELECT "books".* FROM "books" | |
# # LEFT OUTER JOIN "categories" | |
# # ON "books"."category_id" = "categories"."id" | |
# | |
# It also works through association's associations, like `joins` does: | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
procedure VarreItens(MenuItem: TMenuItem; List: TStringList; Nivel: Integer = 0); | |
var | |
str: String; | |
i: Integer; | |
begin | |
str = ''; | |
i := 0; | |
while i < Nivel do | |
begin | |
str = str + ' '; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [[ `whoami` == "root" ]]; then | |
echo "Você está logado como root. Por favor, execute este comando com seu próprio usuário." | |
exit 1 | |
fi | |
sudo apt-get install git -y | |
git clone git@lab.unila.edu.br:dsis/dotfiles.git ~/.dotfiles && cd ~/.dotfiles && script/bootstrap |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main; | |
public class DomainClass { | |
public void doSomething(Object arg0, Proc block) { | |
// do something | |
block.run(arg0); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Essa função você nao precisa, use-a só para ver como a classe é instanciada, pode instanciar direto a impressora USB. | |
// Esse objeto Configuracoes lê de um arquivo INI, vc pode, em vez de usar algo assim, passar a porta fixa. No caso da USB, a impressora vai procurar sozinha todas as portas COM caso a que você passou não funcione. | |
function ObterImpressora: TImpressora; | |
begin | |
if Configuracoes.TipoImpressora = tiSerial then | |
begin | |
Impressora.Porta := Configuracoes.Porta; | |
Result := Impressora; | |
end | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- encoding : utf-8 -*- | |
puts "Cities..." | |
City.transaction do | |
ro = Province.find_by_uf('RO') | |
City.create(province_id: ro.id, id: '1100015', lat: -11.9284, lng: -61.9951, name: 'Alta Floresta D\'Oeste') | |
City.create(province_id: ro.id, id: '1100023', lat: -9.91375, lng: -63.044, name: 'Ariquemes') | |
City.create(province_id: ro.id, id: '1100031', lat: -13.4864, lng: -60.5411, name: 'Cabixi') | |
City.create(province_id: ro.id, id: '1100049', lat: -11.4315, lng: -61.4477, name: 'Cacoal') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package br.com.clouded.web.service.support; | |
import java.io.ByteArrayOutputStream; | |
import java.io.IOException; | |
import java.util.ArrayList; | |
import java.util.Date; | |
import java.util.List; | |
import org.apache.http.HttpResponse; | |
import org.apache.http.HttpStatus; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ModalDialogHelper | |
def modal_dialog(options={},&block) | |
content_tag :div, {class: 'modal hide fade', tabindex: -1, role: 'dialog'}.merge(options), &block | |
end | |
def modal_header(options={},&block) | |
content_tag :div, {class: 'modal-header'}.merge(options), &block | |
end | |
def modal_body(options={},&block) |