Skip to content

Instantly share code, notes, and snippets.

View abelorian's full-sized avatar
🎯
Focusing

Abel O'Rian abelorian

🎯
Focusing
  • Santiago, Chile.
  • 04:58 (UTC -04:00)
View GitHub Profile
@abelorian
abelorian / get_random_products.php
Created April 19, 2015 02:20
Get random products - Woocommerce
$args = array(
'posts_per_page' => 1,
'orderby' => 'rand',
'post_type' => 'product' );
$random_products = get_posts( $args );
foreach ( $random_products as $post ) : setup_postdata( $post ); ?>
<li>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
@abelorian
abelorian / last_day_month.js
Created June 12, 2015 22:31
Last day of month [javascript]
function last_day(yyyy, mm){
var sum = parseInt(mm) + 1;
int_d = new Date(yyyy, sum ,1);
var dd = new Date(int_d - 1);
return dd;
}
var today = new Date();
var mm = today.getMonth();
@abelorian
abelorian / ng-watch-example.js
Created July 2, 2015 06:08
watch angularjs example
$scope.incomes = {'max': 100};
$scope.$watch(function() {
return $scope.incomes.max;
}, function(newValue, oldValue) {
console.log("change detected: " + newValue)
});
@abelorian
abelorian / carousel-bxslider-wp.php
Created July 8, 2015 17:43
Carousel BxSlider Shortcode
@abelorian
abelorian / rainbow-background.css
Last active August 29, 2015 14:27
CSS rainbow background
background-image: linear-gradient(to right, #34495e, #34495e 25%,
#9b59b6 25%, #9b59b6 35%, #3498db 35%, #3498db 45%, #62cb31 45%,
#62cb31 55%, #ffb606 55%, #ffb606 65%, #e67e22 65%, #e67e22 75%,
#e74c3c 85%, #e74c3c 85%, #c0392b 85%, #c0392b 100%);
@abelorian
abelorian / compression.rb
Created August 10, 2015 01:56
Comprimir Assets en Rails
Rails.application.configure do
# Use environment names or environment variables:
# break unless Rails.env.production?
break unless ENV['ENABLE_COMPRESSION'] == '1'
# Strip all comments from JavaScript files, even copyright notices.
# By doing so, you are legally required to acknowledge
# the use of the software somewhere in your Web site or app:
uglifier = Uglifier.new output: { comments: :none }
@abelorian
abelorian / RemoveWWWsubdomain.rb
Created September 20, 2015 19:59
Remove www subdomin from url - Ruby on Rails
constraints subdomain: 'www' do
get ':any', to: redirect(subdomain: nil, path: '/%{any}'), any: /.*/
end
@abelorian
abelorian / sublime_text_reindent.md
Last active October 17, 2015 22:09
Sublime Text Reindent HotKey

Sublime Text Reindent HotKey

  • Go to Preferences -> Key Bindings - User

  • Paste this code for hotkey ctrl+shift+ñ:

[ { "keys": ["ctrl+shift+ñ"], "command": "reindent", "args": {"single_line": false}} ]
@abelorian
abelorian / jquery.validator.spanish.js
Last active December 23, 2015 19:11
Jquery validator spanish
/* Translated validation error messages to Spanish */
/* Author: https://github.com/iamravenous */
$.extend($.validator.messages, {
required: "Este campo es obligatorio.",
remote: "Por favor, rellena este campo.",
email: "Por favor, escribe una dirección de correo válida.",
url: "Por favor, escribe una URL válida.",
date: "Por favor, escribe una fecha válida.",
dateISO: "Por favor, escribe una fecha (ISO) válida.",
@abelorian
abelorian / if_one_line.html
Last active January 4, 2016 18:03
IF in one line - Ruby
<title><%= @page_title.present? ? @page_title + " - RSA Chile" : "RSA Chile - Trabaja con nosotros" %></title>