Skip to content

Instantly share code, notes, and snippets.

View FabricioFFC's full-sized avatar

Fabrício Ferrari de Campos FabricioFFC

View GitHub Profile
@FabricioFFC
FabricioFFC / select_to_csv.sql
Created March 22, 2011 19:35
Mysql- Export select to CSV
SELECT 'example', CURTIME()
INTO OUTFILE '/tmp/result.csv'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n'
FROM YOUR_TABLE
class Client < ActiveRecord::Base
LIST_FIELDS = [:code, :corporate_name, :phone, :email]
rails_admin do
label "#{I18n.t('client.menu_name')}"
LIST_FIELDS.each do |f|
list do
field f
end
end
edit do
@FabricioFFC
FabricioFFC / update_repos.sh
Created November 28, 2012 20:07
update git repositories
#!/bin/bash
if [ `whoami` != root ]; then
echo Por favor, rode o script usando sudo
exit
fi
initial_path="/var/www/"
end_path="/sistema-de-avaliacao"
@FabricioFFC
FabricioFFC / robot.js
Created December 5, 2012 19:36
VIZIR ROBOT - Fabricio
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.ahead(100);
@FabricioFFC
FabricioFFC / robot.js
Created December 5, 2012 19:36
VIZIR ROBOT - Fabricio
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.ahead(100);
@FabricioFFC
FabricioFFC / robot.js
Created December 5, 2012 19:36
VIZIR ROBOT - Gandalf
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.clone();
@FabricioFFC
FabricioFFC / robot.js
Created December 7, 2012 19:53
VIZIR Robot - Gandalf The White
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.clone();
@FabricioFFC
FabricioFFC / smart-date-poc.js
Created October 24, 2015 09:29
smart-date-poc
var smartDate = {
addDays: function addDays(value) {
this.setDate(this.getDate() + value * 1);
return this;
}
};
smartDate.addDay = smartDate.addDays;
smartDate.adddays = smartDate.addDays;
smartDate.addday = smartDate.addDays;
@FabricioFFC
FabricioFFC / magento-dev-vizir.md
Created November 6, 2015 20:12
magento-dev-vizir

Procuramos Desenvolvedores com experiência com Magento.

##Requisitos:

  • Experiência em desenvolvimento de e-commerce com Magento;
  • Sólidos conhecimentos em PHP, ou seja, se considere bom e tenha um histórico de projetos na linguagem, utilizando boas práticas;
  • Gostar de resolver problemas;
  • Gostar de aprender;
  • Valorize o trabalho em equipe;

##Diferenciais:

@FabricioFFC
FabricioFFC / solutions.rb
Last active November 14, 2015 14:18
codility tests
# solution for equi exercise
def equi(a)
right_sum = a.inject(:+)
left_sum = 0
a.each_with_index do |value, index|
left_sum += value
return index if left_sum == right_sum
right_sum -= value
end
-1