Skip to content

Instantly share code, notes, and snippets.

View Porta's full-sized avatar

Julián Porta Porta

View GitHub Profile
<?php
if ( has_post_thumbnail( $post_id ) ) {
// check if to show lightbox desc and title
if ( get_option_max( 'pretty_title_show' ) == 'true' ){
$title = ' title="' . get_the_excerpt() . '"';
}
$cat_list = array();
<!DOCTYPE html>
<html>
<head>
<title>La llama que llama</title>
</head>
<body>
<h1>La llama que habla</h1>
<p>
<img title="OLA K ASE" src="http://www.oyemexico.com/wp-content/uploads/2012/12/TUku4-380x285.jpg" alt="Una Llama que habla" />
</p>
# >-----------------------------[ Run 'Bundle Install' ]-------------------------------<
say_wizard "Installing gems. This will take a while."
if prefs.has_key? :bundle_path
run "bundle install --without production --path #{prefs[:bundle_path]} --standalone"
else
run 'bundle install --without production --standalone'
end
# >-----------------------------[ Run 'After Bundler' Callbacks ]-------------------------------<
@Porta
Porta / states.rb
Created May 15, 2012 20:44
Concern
module States
extend ActiveSupport::Concern
included do
state_machine :status, :initial => :new do
event :confirm do
transition :new => :confirmed #, :if => lambda {|order| order.email.present?}
end
@Porta
Porta / ErrorLog.pm
Created April 12, 2012 13:27
Perl error logger to remote server.
package ErrorLog;
use vars qw/@ISA @EXPORT $AUTOLOAD/;
our $App = shift || "empty";
use Exporter;
#export methods. can add more, they will be catch'd by AUTOLOAD
@EXPORT = qw /die warn notify/;
@ISA = 'Exporter';
@Porta
Porta / exercise.rb
Created March 8, 2012 21:22
blindcat
class Modifier < Ohm::Model
include Ohm::Typecast
attribute :name, String
attribute :multiplier, Float
end
############################
@Porta
Porta / application.js
Created March 1, 2012 14:27
Array to Hash
Array.prototype.to_hash = function(id){
id = typeof(id) != 'undefined' ? id : "id";
var self = this;
var out = {};
$.each(this, function(index, element){
out[element[id]] = element;
});
return out;
};
@Porta
Porta / task.rb
Created January 24, 2012 17:38
states
state_machine :status, :initial => :new do
event :accept do
transition :new => :accepted
end
event :reject do
transition :new => :rejected
end
@Porta
Porta / task_spec.rb
Created January 23, 2012 18:40
Test
it "should reject a new task" do
task = Factory(:task)
task.reject
task.rejected.should be_true
end
@Porta
Porta / products_controller.rb
Created May 16, 2011 13:55
ProductsController
class ProductsController < ApplicationController
#OJO ACA, esto limita los responses a SOLO json. podes agregar mas
respond_to :json
  def index
    resultado = Array.new
    Product.find_each do |p|
      resultado.push(p_para_json(p))
    end