Skip to content

Instantly share code, notes, and snippets.

View paulohp's full-sized avatar
🐴
hacking listening to sertanejo.

Paulo Pires paulohp

🐴
hacking listening to sertanejo.
  • @national-nederlanden
  • Den Haag, NL
View GitHub Profile
@paulohp
paulohp / RemittencesController.php
Last active October 11, 2015 05:57
upload a txt and save the data in the db
<?php
/*
* Autor : Hermiro Manoel da Silva Carvalho / Paulo Henrique
* Descrição: Controller responsável pela lógica da captação das linhas do arquivo e
* salvamento dentro da tabela Remittences
* Model: Remittences
*/
App::uses('File', 'Utility');
class RemittencesController extends AppController {
@paulohp
paulohp / grunt.js
Created October 2, 2012 15:58
grunt-compass config
/*global module:false*/
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
meta: {
version: '0.1.0',
banner: '/*! PROJECT_NAME - v<%= meta.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
'* http://www.jvsoftware.com/\n' +
$('#contact-form').submit(function() {
var _nome = $('#message_name')
var _email = $('#message_email')
var _assunto = $('#message_subject')
var _body = $('#message_body')
var valuesToSubmit = {
nome: _nome,
email: _email,
assunto: _assunto,
body: _body
@paulohp
paulohp / robot.js
Created December 1, 2012 13:27
pabrot
//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(50);
@paulohp
paulohp / imagem.rb
Created January 24, 2013 12:05
Envio automatico de imagens para o smush.it via rails. http://mgswolf.blogspot.com.br/2011/09/envio-automatico-de-imagens-para.html
#app/modelos/imagem.rb
class Imagem < ActiveRecord::Base
has_attached_file :photo
after_create :otimiza
def otimiza()
if self.photo_file_size < 1000000 #limite imposto pelo smush.it
require 'rubygems' #desnecessário caso utilize Ruby 1.9
require 'bundler/capistrano'
require 'capistrano-unicorn'
set :default_environment, {
:PATH => '/opt/local/bin:/opt/local/sbin:/opt/local/ruby/gems/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
:GEM_HOME => '/opt/local/ruby/gems'
}
set :application, 'www.awesomeapp.com'
namespace :config_links do
desc "Symlink database.yml"
task :database, :roles => :app do
run "ln -s #{deploy_to}/#{shared_dir}/config/database.yml #{current_release}/config"
end
end
after "deploy:update_code", "config_links:database"
{
'sugestoes':{
'codelab': ['angular', 'polymer', 'googleApi'],
'meetup': ['go'],
'hackiday': ['go']
}
}
{
sugestoes: {
codelab: ['angular', 'polymer', 'dart', 'app script',
{"google apis":
['youtube api', 'maps api', 'drive api']
}],
meetup: ['go', 'angular', 'app script', 'google apis'],
hackiday: ['go', 'google apis + angularjs', 'app script']
}
}
@paulohp
paulohp / keybase.md
Created June 16, 2014 22:37
keybase.md

Keybase proof

I hereby claim:

  • I am paulohp on github.
  • I am paulopires (https://keybase.io/paulopires) on keybase.
  • I have a public key whose fingerprint is 33BF F157 4477 AD49 71D7 9AC3 82D3 374D 6DC4 ED69

To claim this, I am signing this object: