Skip to content

Instantly share code, notes, and snippets.

<html>
<head>
<meta charset=utf-8" />
<title><?php if(isset($title)) echo $title; else echo 'SuperPI';?></title>
<link rel="stylesheet" type="text/css" href="../jquery-file-upload/css/jquery.fileupload-ui.css" />
<script type="text/javascript" src="https//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script type="text/javascript" src="../jquery-file-upload/js/vendor/jquery.ui.widget.js"></script>
<script type="text/javascript" src="../jquery-file-upload/js/jquery.iframe-transport.js"></script>
<script type="text/javascript" src="../jquery-file-upload/js/jquery.fileupload.js"></script>
<?php
class Bd_manager_doctrine extends CI_Controller{
public $entities = '';
public function __construct(){
require_once "/../models/Entities/Admin.php";
require_once "/../models/Entities/Log.php";
require_once "/../models/Entities/Usuario.php";
@danielalvarenga
danielalvarenga / bootstrap.php
Created October 29, 2012 22:14
Gerar tabelas automático com Doctrine
<?php
use Doctrine\ORM\Tools\Setup;
use Doctrine\ORM\EntityManager;
require_once "classes/Admin.php";
require_once "classes/Log.php";
require_once "classes/Usuario.php";
require_once "classes/PremiosUsuario.php";
require_once "classes/Aposta.php";
@danielalvarenga
danielalvarenga / database.yml
Last active August 29, 2015 14:07
Configuração de projeto rails (Spree Commerce) para deploy utilizando Capistrando e Unicorn
# Database config shared in Capistrano 3: .../shared/config/database.yml
# MySQL. Versions 5.0+ are recommended.
#
# Install the MYSQL driver
# gem install mysql2
#
# Ensure the MySQL gem is defined in your Gemfile
# gem 'mysql2'
#
@danielalvarenga
danielalvarenga / script-install-all-ubuntu14.sh
Last active February 19, 2016 11:02
Script Instalação Ubuntu 14.10 (customizable for vagrant provision)
#!/bin/bash
# Autor: Daniel Alvarenga Lima <danielalvarengalima@gmail.com>
# Versão do Ubuntu suportada: 14.10 64Bit
# Versão deste Script: 2015-05-20
# EXECUTE
# sudo chmod +x script-install-all-ubuntu.sh
# ./script-install-all-ubuntu.sh
$ bundle exec sidekiq
2015-07-24T14:51:37.763Z 5115 TID-8n3is INFO: Booting Sidekiq 3.4.2 with redis options {:url=>"redis://localhost:6379/12", :db=>1, :namespace=>"superofertas"}
[WARNING] You are not setting Devise.secret_key within your application!
You must set this in config/initializers/devise.rb. Here's an example:
Devise.secret_key = "1f6cfe65c936664f0d9c5b49b9f4cf5cc86cf400e9fee6582d82eb7620dbdf0a551b99de883c0a6540fb08656251968085ed"
Instance method "open" is already defined in Object, use generic helper instead or set StateMachines::Machine.ignore_method_conflicts = true.
Cannot define multiple 'included' blocks for a Concern
/home/dev/.rvm/gems/ruby-2.2.2/gems/activesupport-4.2.2/lib/active_support/concern.rb:126:in `included'
/home/dev/.rvm/gems/ruby-2.2.2/bundler/gems/spree-222ae3a9dfa9/core/app/models/spree/order/checkout.rb:6:in `<module:Checkout>'
@danielalvarenga
danielalvarenga / ajax-post.js
Last active October 8, 2015 17:40
Ajax call with header params example.
Adicionar JQuery ao console
javascript:if(!window.jQuery||confirm('Overwrite\x20current\x20version?\x20v'+jQuery.fn.jquery))(function(d,s){s=d.createElement('script');s.src='https://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.js';(d.head||d.documentElement).appendChild(s)})(document);
Chamada AJAX
$.ajax({
headers: {
"Accept": "application/json; charset=utf-8",
"Content-Type": "application/json; charset=utf-8",
@danielalvarenga
danielalvarenga / application_controller.rb
Created October 8, 2015 17:48
Add Header params to configure CORS for Rails 4 API
before_filter :allow_cors
def allow_cors
headers["Access-Control-Allow-Origin"] = "*"
headers["Access-Control-Allow-Methods"] = %w{GET POST PUT DELETE OPTIONS}.join(",")
headers["Access-Control-Allow-Headers"] = %w{Origin Accept Content-Type X-Requested-With X-Prototype-Version X-CSRF-Token token}.join(",")
headers['Access-Control-Max-Age'] = "1728000"
if request.method == 'OPTIONS'
render :text => '', :content_type => 'text/plain'
end
@danielalvarenga
danielalvarenga / terminal-colors-branch.sh
Last active September 13, 2024 18:22
Show branch in terminal Ubuntu
# Add in ~/.bashrc or ~/.bash_profile
function parse_git_branch () {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
RED="\[\033[01;31m\]"
YELLOW="\[\033[01;33m\]"
GREEN="\[\033[01;32m\]"
BLUE="\[\033[01;34m\]"
NO_COLOR="\[\033[00m\]"
@danielalvarenga
danielalvarenga / gitconfig
Last active December 16, 2015 01:19 — forked from tdtadeu/gitconfig
[user]
name = Daniel Alvarenga
email = danielalvarengalima@gmail.com
[core]
editor = vim -f
[alias]
df = diff
st = status
ci = commit
co = checkout