Skip to content

Instantly share code, notes, and snippets.

View simaob's full-sized avatar

Simão Belchior simaob

View GitHub Profile
import React, { Component, Fragment } from 'react';
import PropTypes from 'prop-types';
import qs from 'qs';
import SearchFilter from '../../SearchFilter';
/* import TimeRangeFilter from '../../TimeRangeFilter'; */
function getQueryFilters() {
return qs.parse(window.location.search.slice(1));
}
@simaob
simaob / gtportugal.conf
Created June 13, 2015 13:28
gtportugal nginx conf
upstream gtportugal {
# Path to Unicorn SOCK file, as defined previously
server unix:/tmp/unicorn.gtportugal.sock fail_timeout=0;
}
server {
listen 80;
#server_name gtportugal.simaobelchior.net;
server_name localhost;
@simaob
simaob / change_type.rb
Created June 7, 2012 22:55
A quick dictionary module
class ChangeType < ActiveRecord::Base
attr_accessible :listing_change_id, :name
include Dictionary
build_dictionary :addition, :deletion, :reservation, :reservation_withdrawal
end
@simaob
simaob / _ordering.html.erb
Created November 6, 2011 19:40
Ordering records through index page record with AJAX (powered by jQuery) in a Ruby on Rails 3.1 App
<%#PATH: app/views/products/ %>
<% if !product.first? %>
<%= link_to image_tag("ordering_icons/up.gif", :alt => "up", :title => "Move up"), move_up_product_path(product), :method => :put, :remote => true %>
<% end %>
<% if !product.last? %>
<%= link_to image_tag("ordering_icons/down.gif", :alt => "down", :title => "Move down"), move_down_product_path(product), :method => :put, :remote => true %>
<% end %>
@simaob
simaob / _attachment_fields.html.erb
Created November 4, 2011 00:40
Ruby on Rails - Nested Attributes
<div class="attachment fields">
<%= f.label :caption %>
<%= f.file_field :document %>
<%= link_to_remove_fields "remove", f %>
</div>
@simaob
simaob / manifest_files
Created September 20, 2011 12:14
Asset Pipeline and Upgrading to Rails 3.1
#application.js
//= require jquery
//= require jquery_ujs
//= require_self
//= require_tree .
/* rest of file omitted */
#application.css
@simaob
simaob / crontab_list
Created July 19, 2011 12:04
Backup config file for db_name
# Begin Whenever generated tasks for: backups
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
32 11 * * * /bin/bash -l -c 'backup perform -t db_name -c ~/Backup/db_name.rb >> ~/Backup/log/whenever_cron.log 2>&1'
0 0 1 12 * /bin/bash -l -c 'backup perform -t db_name -c ~/Backup/db_name_yearly.rb >> ~/Backup/log/whenever_cron.log 2>&1'
0 0 1 * * /bin/bash -l -c 'backup perform -t db_name -c ~/Backup/db_name_monthly.rb >> ~/Backup/log/whenever_cron.log 2>&1'