Skip to content

Instantly share code, notes, and snippets.

Avatar

Simão Belchior simaob

View GitHub Profile
View page.js
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 Jun 13, 2015
gtportugal nginx conf
View gtportugal.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 Jun 7, 2012
A quick dictionary module
View change_type.rb
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 Nov 6, 2011
Ordering records through index page record with AJAX (powered by jQuery) in a Ruby on Rails 3.1 App
View _ordering.html.erb
<%#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 Nov 4, 2011
Ruby on Rails - Nested Attributes
View _attachment_fields.html.erb
<div class="attachment fields">
<%= f.label :caption %>
<%= f.file_field :document %>
<%= link_to_remove_fields "remove", f %>
</div>
@simaob
simaob / manifest_files
Created Sep 20, 2011
Asset Pipeline and Upgrading to Rails 3.1
View manifest_files
#application.js
//= require jquery
//= require jquery_ujs
//= require_self
//= require_tree .
/* rest of file omitted */
#application.css
@simaob
simaob / crontab_list
Created Jul 19, 2011
Backup config file for db_name
View crontab_list
# 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'
You can’t perform that action at this time.