Skip to content

Instantly share code, notes, and snippets.

View soberanes's full-sized avatar
🥑
Enjoying

Paul Soberanes soberanes

🥑
Enjoying
View GitHub Profile
/**
* Return the pair numbers of a list given, positive or negative ones.
*/
function pair(list) {
var val = 0;
var tmp = [];
for (i=0; i<list.length; i++) {
val = list[i];
for (j=0; j<list.length; j++) {
@soberanes
soberanes / SoapClient.php
Created December 7, 2017 18:18 — forked from umpirsky/SoapClient.php
PHP SOAP client for .NET SOAP server
<?php
class SoapClient extends \SoapClient {
function __doRequest($request, $location, $action, $version, $one_way = null) {
$headers = array(
'Method: POST',
'Connection: Close',
'User-Agent: PHP Soap Client',
@soberanes
soberanes / Form.php
Created November 8, 2017 21:54 — forked from ScreamingDev/Form.php
Mage - Adminhtml - Form fields (simple)
<?php
// text
$fieldset->addField('title', 'text', array(
'label' => Mage::helper('form')->__('Title3'),
'class' => 'required-entry',
'required' => true,
'name' => 'title',
'onclick' => "alert('on click');",
'onchange' => "alert('on change');",
@soberanes
soberanes / HTML Character Codes
Created September 15, 2017 14:46 — forked from jonathansousa/HTML Character Codes
HTML: Character Codes
Name Character Entity
Copyright © &copy;
Registered ® &reg;
Trademark ™ &trade;
Curly Open Double Quote “ &ldquo;
Curly Closed Double Quote ” &rdquo;
Curly Open Single Quote ‘ &lsquo;
Curly Closed Single Quote ’ &rsquo;
Big Bullet/Dot • &bull;
@soberanes
soberanes / hook_transliterate.php
Created January 18, 2017 23:58
Codificar un string de diferentes fuentes
<?php
function hook_transliterate($string) {
$string = str_replace("á", "á", $string);
$string = str_replace("é", "é", $string);
$string = str_replace("í", "í", $string);
$string = str_replace("ó", "ó", $string);
$string = str_replace("ú", "ú", $string);
$string = str_replace("ñ", "ñ", $string);
$string = str_replace("ä", "a", $string);
$string = str_replace("ë", "e", $string);
<?php
/**
* Adding this script to functions.php
*/
add_filter( 'wp', 'disable_plugin_assets' );
function disable_plugin_assets(){
if(strpos($_SERVER['REQUEST_URI'], '/page-slug/') === FALSE) {
//Disable facturacom plugin's assets
//Javascript
<?php
//Para visualizar el documento en el navegador, agregamos este header.
header("Content-Type: text/plain");
//Incluímos la clase OrderItems
require_once "OrderItems.php";
/*
Creamos una instancia de la clase DOMDocument de PHP.
Aquí establecemos la versión de XML y la codificación del documento.
<?php
/**
* Clase OrderItems de inicialización
*/
class OrderItems
{
public $sku;
public $name;
public $price;
public $qty;
CREATE TABLE `users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(255) NOT NULL,
`password` varchar(255) NOT NULL,
`ip_address` varchar(48) NOT NULL,
`reg_time` varchar(10) NOT NULL,
`reg_date` varchar(20) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InooDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;
<?php
//Registramos nuestras clases utilizando el autoloader
spl_autoload_register(function($class_name){
include $class_name . '.php';
});
$users = new ManageUsers();
echo 'Registros creados: ' .
$users->registerUsers('paul', 'temporalpwd', '127.0.0.1', '12:00', '21-09-2016');