Skip to content

Instantly share code, notes, and snippets.

View felipeorlando's full-sized avatar
:shipit:
getting ship done

Felipe Orlando felipeorlando

:shipit:
getting ship done
View GitHub Profile
CREATE TABLE `ci_omni_financeira`.`correspondentes` (
`id` INT NOT NULL AUTO_INCREMENT,
`razao` VARCHAR(255) NULL,
`nome` VARCHAR(255) NULL,
`endereco` VARCHAR(255) NULL,
`cidade` VARCHAR(255) NULL,
`estado` VARCHAR(255) NULL,
`cnpj` INT NOT NULL,
`servicos` VARCHAR(255) NULL,
`deletado` TINYINT(1) NULL DEFAULT '0',
;(function(){
var $phone = $('.phone');
var init = function () {
maskAll();
};
var SPMaskBehavior = function (val) {
return val.replace(/\D/g, '').length === 11 ? '(00) 00000-0000' : '(00) 0000-00009';
},
;(function(){
var $accordion = $('.accordion'),
title = '.accordion .title',
$boxes = $accordion.find('.box');
$(document)
.on('click', title, console.log('yo!'))
;
})();
class Notice < ActiveRecord::Base
validates_presence_of :notice_category
has_many :notice_locales, :dependent => :destroy
accepts_nested_attributes_for :notice_locales, :allow_destroy => true
belongs_to :notice_category
has_one :notice_category_locale#, :foreign_key =>
has_attached_file :image, styles: { medium: "300x300>", thumb: "100x100>", my_admin: "150x150>"}, default_url: "/images/:style/missing.png"
@felipeorlando
felipeorlando / stranger_things.js
Created September 22, 2016 01:42 — forked from brendomaciel/javascript_stranger_things.md
JavaScript "Stranger Things"
/**
* ATENÇÃO:
*
* O JavaScript possui uma série de "stranger things" em relação a algumas instruções.
* Portanto, tome cuidado se precisar utilizar qualquer uma dessas instruções listadas abaixo.
*
* Obs. 1: O ">" indica uma linha de instrução e a linha seguinte à essa indica o seu retorno.
* Obs. 2: O fato de o retorno não ser esperado ou óbvio, não quer dizer que, necessáriamente, ele seja um bug ou algo
* que passou despercebido pelas pessoas que matêm a linguagem e/ou interpretadores.
*/
@felipeorlando
felipeorlando / has_many_locale.html.erb
Created September 28, 2016 17:32
app/views/my_admin/fields/edit/type/has_many_locale.html.erb
<style media="screen">
.tabs-locale{
border: 1px solid #dddddd;
}
.tabs-locale a{
border-radius: 0px 0px 0 0!important;
}
</style>
<% has_many_model = model.reflections[field.to_s].klass %>
<div role="tabpanel" class="tab-pane <%= index == 0 ? 'active' : ''%>" id="locale_<%= locale.acronym %>">
<%= form.fields_for(field, item) do |has_many_form| %>
<%= has_many_form.hidden_field :locale_id %>
<% has_many_model.my_admin.fieldsets.each do |has_many_fieldset| %>
<%= content_tag(:fieldset) do %>
<%= content_tag(:legend, fieldset_title(application, has_many_model, has_many_fieldset[:name])) if has_many_fieldset.has_key? :name %>
<% has_many_fieldset[:fields].each do |has_many_field| %>
<%= edit_field_struct(application, has_many_model, has_many_field, item, has_many_form ) %>
<% end %>
<% end %>
module ApplicationHelper
def locale_time(timestamp)
timestamp.strftime("%d/%m/%Y")
end
end
<% if @seo_title.blank? %>
<title>Nitro Química</title>
<% else %>
<title><%= @seo_title %> - Nitro Química</title>
<% end %>
<% unless @seo_description.blank? %>
<meta name="description" content="<%= @seo_description %>">
<% end %>
if @contact.save
flash[:success] = 'Seus dados foram enviados com sucesso! Em breve entraremos em contato'
ContactMailer.contact(@contact).deliver_now
redirect_to action: "index"
else
flash[:error] = 'Não foi possível salvar seus dados!'
redirect_to action: "index"
end