Skip to content

Instantly share code, notes, and snippets.

View pragmaticivan's full-sized avatar
Permanent 418 status code.

Ivan Santos pragmaticivan

Permanent 418 status code.
View GitHub Profile
public function findAll($options = array()){
$defaults = array();
$options = array_merge($defaults,$options);
$fields = "blogs.id, blogs.orelha, blogs.titulo, concat(blogs.slug,'.html') as slug, blogs.bigode, blogs.texto, blogs.fonte,
blogs.autor, blogs.data_hora, blogs.ext_arquivo, blogs.legenda, blogs.creditos, blogs.censurada,
blogs.video, blogs.comentarios, blogs.tags, blogs.ativo, blogs.hits,
blogs.ordem, imagens_areas.destaque, imagens_areas.legenda, imagens_areas.creditos, imagens_areas.imagens_id,
imagens.ext_arquivo, imagens.censurada,categorias.slug as slug_categoria, categorias.categoria as categoria_name,
categorias.id as id_categoria, categorias.ext_arquivo as imagem_categoria";
if (isset($options['comments']) and $options['comments']) {
@pragmaticivan
pragmaticivan / controller.php
Created May 18, 2011 14:33
Possibilidade de array no only e except para as before actions
/**
* Executa os métodos adicionados no before e after action.
*
* @param array $methods
* @return void
*/
private function execute_methods($methods) {
foreach ($methods as $key => $value) {
if (is_array($value)) {
if (isset($value['only'])) {
@pragmaticivan
pragmaticivan / movie.php
Created March 31, 2012 21:59
Movie Helper
class MovieHelper {
/**
* Armazena a opção de hospedagem do video (VIMEO ou Youtube)..
*
* @access public
* @var string
*/
private $location;
@pragmaticivan
pragmaticivan / .gitignore
Created November 18, 2012 02:31 — forked from redoPop/.gitignore
Template .gitignore file for WordPress projects
# This is a template .gitignore file for git-managed WordPress projects.
#
# Fact: you don't want WordPress core files, or your server-specific
# configuration files etc., in your project's repository. You just don't.
#
# Solution: stick this file up your repository root (which it assumes is
# also the WordPress root directory) and add exceptions for any plugins,
# themes, and other directories that should be under version control.
#
# See the comments below for more info on how to add exceptions for your
@pragmaticivan
pragmaticivan / deploy.rb
Created February 20, 2013 18:14 — forked from reu/deploy.rb
# Bundler Integration
require "bundler/capistrano"
# Application Settings
set :application, "yourapplicationname"
set :user, "serveruser"
set :deploy_to, "/home/#{user}/rails-applications/#{application}"
set :rails_env, "production"
set :use_sudo, false
set :keep_releases, 3

Install Postgresql on Mountain Lion

Based on: http://coderwall.com/p/1mni7w

brew install postgresql
initdb /usr/local/var/postgres -E utf8
mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/postgresql/9.1.4/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
# Support for Rspec / Capybara subdomain integration testing
# Make sure this file is required by spec_helper.rb
# (e.g. save as spec/support/subdomains.rb)
def switch_to_subdomain(subdomain)
# lvh.me always resolves to 127.0.0.1
hostname = subdomain ? "#{subdomain}.lvh.me" : "lvh.me"
Capybara.app_host = "http://#{hostname}"
end
# Support for Rspec / Capybara subdomain integration testing
# Make sure this file is required by spec_helper.rb
#
# Sample subdomain test:
# it "should test subdomain" do
# switch_to_subdomain("mysubdomain")
# visit root_path
# end
DEFAULT_HOST = "lvh.me"
// Generated on <%= (new Date).toISOString().split('T')[0] %> using <%= pkg.name %> <%= pkg.version %>
(function () {
"use strict";
module.exports = function (grunt) {
// Project Configuration
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),