Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Thiago Ribeiro thiagovsk

🏠
Working from home
View GitHub Profile
View gist:8023164
<script type="text/javascript">
$(function() {
function cutAndPaste(from, to) {
$(to).append(function() {
return $(from + " option:selected").each(function() {
this.outerHTML;
}).remove();
View gist:8023183
# -*- encoding : utf-8 -*-
class TypesController < ApplicationController
# GET /types
# GET /types.json
def index
@types = Type.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @types }
View gist:8023187
# -*- encoding : utf-8 -*-
class PlacesController < ApplicationController
# GET /places
# GET /places.json
def index
@places = Place.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @places }
View gist:8037312
<script type="text/javascript">
$(function() {
function cutAndPaste(from, to) {
$(to).append(function() {
return $(from + " option:selected").each(function() {
this.outerHTML;
}).remove();
View gist:8647920
<div class="page-header">
<%= simple_form_for(@atendimento, :html => {:class => 'form-horizontal' }) do |f| %>
</div>
View gist:8648120
<dirv class="page-header">
<%= simple_form_for(@atendimento, :html => {:class => 'form-horizontal' }) do |f| %>
<div class="actions">
<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
View gist:8977659
require "cancan/matchers"
require 'spec_helper'
describe "User" do
describe "Ability" do
subject(:ability){ Ability.new(user) }
let(:user){ nil }
View gist:8977685
# Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
factory :user do |f|
f.name "Alessandro"
f.username "alessandrocb"
f.matricula "123456789"
f.password "123456789"
f.password_confirmation "123456789"
f.after(:create) {|user| user.add_role(:student)}
View gist:11092710
class CreateConvenios < ActiveRecord::Migration
def change
create_table :convenios do |t|
t.string :numeroconvenio
t.string :uf
t.string :codigosiafi
t.string :nomemunicipio
t.string :situacaoconvenio
t.string :numerooriginal
t.string :objetoconvenio
View gist:11094185
private
# Use callbacks to share common setup or constraints between actions.
def set_convenio
@convenio = Convenio.find(params[:id])
end
# Never trust parameters from the scary internet, only allow the white list through.
def convenio_params
params.require(:convenio).permit(:numeroconvenio, :uf, :codigosiafi, :nomemunicipio, :situacaoconvenio, :numerooriginal, :objetoconvenio, :codigoorgaosuperior, :nomeorgaosuperior, :codigoconcedente, :nomeconcedente, :codigoconvenente, :nomeconvenente, :tipoenteconvenente, :valorconvenio, :valorliberado, :datapublicacao, :datainiciovigencia, :datafimvigencia, :valorcontrapartida, :dataultimaliberacao, :valorultimaliberacao)