Skip to content

Instantly share code, notes, and snippets.

View YuriFontella's full-sized avatar
💭
sad dev

Yuri Fontella YuriFontella

💭
sad dev
  • Porto Alegre - RS
View GitHub Profile
@YuriFontella
YuriFontella / admin.php
Created October 18, 2014 15:52
Controller dentro do diretório modules
<?php
namespace Admin;
class Controller_Vendas extends \Controller_Rest {
//Chamando uma function de outro module
public function get_fornecedores() {
@YuriFontella
YuriFontella / exemplo.php
Created October 23, 2014 15:30
Model, View e Controller Categoria e os itens dessa categoria
//MODEL
public function categorias_item() {
$loja = $this->load->database('loja', TRUE);
$query = $loja->query("SELECT * FROM categorias ORDER BY categoria ASC");
foreach($query->result_array() as $row) {
$categoria = $row['categoria'];
<?php
class Model_Ativos extends Orm\Model
{
protected static $_properties = array(
'id',
'user_id',
'created_at',
);
<?php
public static function publics_slide()
{
$query = DB::select()
->from('publics')
->limit(4)
->execute();
foreach($query as $row)
$query = DB::select('*')
->select(array(DB::expr('LEFT(`descricao`,10)'), 'descricao'))
->from('publics')
->limit(4)
->execute();
------------------------------------------------------------------
public static function publics_slide()
{
@YuriFontella
YuriFontella / index.htm.erb
Created June 27, 2015 20:43
validates attr específico
<%= form_for @user, :html => { :class => 'ui form attached fluid segment cadastro', :onsubmit => 'cadastro()' } do |f| %>
<% if @user.errors[:email].any? %>
<div class="ui error message visible">
<div class="header"><i class="icon attention"></i>Atenção</div>
<p><%= @user.errors[:email] %></p>
</div>
<% end %>
<div class="two fields">
class Session
include ActiveModel::Model
attr_accessor :email, :password
validates :email, :presence => { :message => 'Entre com o seu e-mail' }
validates :password, :presence => { :message => 'Coloque a sua senha' }
def initialize(attr={})
@email = attr[:email]
@password = attr[:password]
@YuriFontella
YuriFontella / CompizLastRide.sh
Created August 30, 2015 22:32 — forked from frankIT/CompizLastRide.sh
last ride with compiz: build it on debian jessie
#!/bin/bash
# http://wiki.compiz.org/C%2B%2BCompiling
# This is basically a script version of the official documentation above
# with a few fix needed to successfully compile on debian jessie
wget https://launchpad.net/compiz/0.9.12/0.9.12.2/+download/compiz-0.9.12.2.tar.bz2
tar -xf compiz-0.9.12.2.tar.bz2
rm compiz-0.9.12.2.tar.bz2
cd compiz-0.9.12.2/
@YuriFontella
YuriFontella / filesInvite.rb
Last active November 10, 2015 01:38
Form/Mail/Rails
# Formulário
<%= form_tag invites_path, class: 'ui invite' do %>
<div class="ui action input" style="width:45%">
<%= text_field_tag 'email', nil, placeholder: "E-mail..." %>
<div class="ui icon button refresh" type="submit"><i class="mail icon"></i></div>
</div>
<% end %>
# Controller
@YuriFontella
YuriFontella / nginx.conf
Last active February 29, 2016 23:21
Passenger nginx file conf
worker_processes 1;
error_log /opt/nginx/logs/error.log;
pid /opt/nginx/logs/nginx.pid;
events {
worker_connections 1024;
}
http {