Skip to content

Instantly share code, notes, and snippets.

View macagua's full-sized avatar
🏠
Working from home

Leonardo J. Caballero G. macagua

🏠
Working from home
View GitHub Profile
def cargar_datos(request):
"""!
Función para cargar los datos de carga masiva
@author Ing. Roldan Vargas (rvargas at cenditel.gob.ve)/ Rodrigo Boet (rboet at cenditel.gob.ve)
@copyright <a href='http://www.gnu.org/licenses/gpl-2.0.html'>GNU Public License versión 2 (GPLv2)</a>
@date 11-08-2016
@param request <b>{object}</b> Objeto que contiene la petición
@return Devuelve un HttpResponse con el JSON correspondiente al estado de la petición
"""
@labra
labra / apiPedido.js
Last active August 4, 2022 04:04
API Rest de pedidos
'use strict';
let http= require('http'),
url = require('url'),
qs = require('querystring');
let Pedido = require('./pedido.js');
let pedido = new Pedido;
pedido.insertaProducto(23,"Botella",3);
@labra
labra / pedido.js
Created December 3, 2016 15:57
Clase Pedido
'use strict';
class Pedido {
constructor() {
this.productos = {};
}
getProducto(id) {
if (id in this.productos)
return this.productos[id];
@Dalboz
Dalboz / damedolar.py
Last active August 22, 2024 12:35
one liner para ver el precio del dólar paralelo :(
python -c "import requests; print({key: value for key, value in requests.post('https://dolartoday.com/wp-admin/admin-ajax.php', data={'action': 'dt_currency_calculator_handler', 'amount': '1'}).json().items()})"
alias paver-collectstatic='cd /edx/app/edxapp/edx-platform; date; time python manage.py lms --settings=aws collectstatic --noinput'
alias paver-compile='cd /edx/app/edxapp/edx-platform; time paver update_assets lms --settings=aws'
alias paver-compile-debug='cd /edx/app/edxapp/edx-platform; time paver update_assets lms --settings=aws --debug'
alias paver-go='cd /edx/app/edxapp/edx-platform; paver update_assets lms --settings=aws; paverdevstack lms --fast'
alias paver-run='cd /edx/app/edxapp/edx-platform; paver devstack lms --fast'
alias theme-base='cd /edx/app/edxapp/themes/dentalpost-theme/lms/static/sass/partials/base'
@zek
zek / fix.wkhtmltopdf.odoo.snippetbucket.erp.open.source.seo.sh
Created October 4, 2016 17:52 — forked from tejastank/fix.wkhtmltopdf.odoo.snippetbucket.erp.open.source.seo.sh
Wkhtmltopdf failed (error code: -6). Message: The switch --header-spacing, is not support using unpatched qt, and will be ignored.The switch --header-html, is not support using unpatched qt, and will be ignored.The switch --footer-html, is not support using unpatched qt, and will be ignored.QXcbConnection: Could not connect to display.
How to Fix it:
1. Remove wkhtmltopdf and related package
$ sudo apt-get remove libqt4-dev qt4-dev-tools wkhtmltopdf
$ sudo apt-get autoremove
2. Install requirement package for compiling
$ sudo apt-get install openssl build-essential libssl-dev libxrender-dev git-core libx11-dev libxext-dev libfontconfig1-dev libfreetype6-dev fontconfig -y
# Enable request logging in Odoo using one of the following:
# * pass --log-level=debug_rpc
# * or pass --log-handler=odoo.http.rpc.request:DEBUG (to only debug request times)
# * or set the equivalent config option in the Odoo config file
# Then save the following as a munin plugin to monitor the last 5 minutes of your Odoo config file
# Be sure to set the correct path for the Odoo log file, and adjust the variables as needed
#!/bin/bash
@lalviarez
lalviarez / _form.php
Last active March 13, 2017 21:07
Yii2 combolist ajax
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;
use yii\helpers\Url;
use yii\web\View;
/* @var $this yii\web\View */
/* @var $model common\models\ConsejoComunal */
/* globals define */
define(function(){
'use strict';
var REGISTERED = {};
var register = function(name, config){
REGISTERED[name] = config;
};
@vaporic
vaporic / cors-laravel.md
Last active March 22, 2021 11:26
CORS Laravel 5.1

Activar CORS Laravel 5.1

Para activar los CORS se edita el archivo /bootstrap/app.php

header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, PUT, POST, DELETE, OPTIONS');
header('Access-Control-Allow-Credentials: true');
header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Authorization");
if($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {