Skip to content

Instantly share code, notes, and snippets.

<?php
public function hasValidCert()
{
if (!isset($_SERVER['SSL_CLIENT_M_SERIAL'])
|| !isset($_SERVER['SSL_CLIENT_V_END'])
|| !isset($_SERVER['SSL_CLIENT_VERIFY'])
|| $_SERVER['SSL_CLIENT_VERIFY'] !== 'SUCCESS'
|| !isset($_SERVER['SSL_CLIENT_I_DN'])
) {
return false;
-- ejercicio 2
use LaboSQL_12;
select authors.au_lname, authors.au_fname, titles.title from authors
inner join titleauthor on authors.au_id = titleauthor.au_id
inner join titles on titles.title_id = titleauthor.title_id;
-- ejercicio 3
select * from authors
where state = 'CA' and au_lname not like 'M%';
@dsueiro
dsueiro / cmsblockfix.diff
Created December 15, 2016 00:22 — forked from piotrekkaminski/cmsblockfix.diff
cms block fix
diff --git a/app/code/core/Mage/Cms/Block/Block.php b/app/code/core/Mage/Cms/Block/Block.php
index bc81de3..a0dce44 100755
--- a/app/code/core/Mage/Cms/Block/Block.php
+++ b/app/code/core/Mage/Cms/Block/Block.php
@@ -72,4 +72,24 @@ protected function _toHtml()
}
return $html;
}
+
+ /**
@dsueiro
dsueiro / warmly.sh
Created October 5, 2016 20:03 — forked from thomasfr/warmly.sh
A wget based easy poor man`s cache warmer script
#!/bin/bash
# warmly.sh
# A wget based, easy, poor man`s cache warmer script
# https://gist.github.com/thomasfr/7926314
# The MIT License (MIT)
#
# Copyright (c) 2013,2014 Thomas Fritz <fritztho@gmail.com> (http://fritzthomas.com)
#
@dsueiro
dsueiro / shell.c
Created September 12, 2016 20:02 — forked from parse/shell.c
Simple shell in C
/* Compile with: g++ -Wall –Werror -o shell shell.c */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
@dsueiro
dsueiro / 0001-BUGIFX-Magento-Zend-Framework-1-PHP5.6.patch
Created July 26, 2016 20:52 — forked from renttek/0001-BUGIFX-Magento-Zend-Framework-1-PHP5.6.patch
Bugfix for Zend Framework 1 in Magento (>= 1.7.*.*) + PHP 5.6
From 473846959772d8160b34b92ae3bcecddf24b972f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Julian=20Nu=C3=9F?= <julian.nuss@outlook.com>
Date: Tue, 23 Sep 2014 21:07:29 +0200
Subject: [PATCH 1/1] [BUGIFX] Zend Framework 1 + PHP5.6
---
lib/Zend/Locale/Format.php | 22 +++++++++++-----------
lib/Zend/Service/Audioscrobbler.php | 6 +++---
lib/Zend/Service/Technorati.php | 6 +++---
lib/Zend/Validate/Hostname.php | 4 ++--
@dsueiro
dsueiro / clean_magento.sql
Created December 30, 2015 12:08
Deletes all user generated data in Magento
-- DELETE ALL PRODUCTS
TRUNCATE TABLE `catalog_product_bundle_option`;
TRUNCATE TABLE `catalog_product_bundle_option_value`;
TRUNCATE TABLE `catalog_product_bundle_selection`;
TRUNCATE TABLE `catalog_product_entity_datetime`;
TRUNCATE TABLE `catalog_product_entity_decimal`;
TRUNCATE TABLE `catalog_product_entity_gallery`;
TRUNCATE TABLE `catalog_product_entity_int`;
TRUNCATE TABLE `catalog_product_entity_media_gallery`;
TRUNCATE TABLE `catalog_product_entity_media_gallery_value`;
@dsueiro
dsueiro / name_md5.php
Last active November 3, 2015 15:01
name_md5
#!/usr/bin/php
<?php
if (count($argv) < 3 || count($argv) > 4) {
die("Uso:\n\tphp {$argv[0]} <filename> type [--no_underscores]\nIt generates a file yyyymmddhhiiss_md5hash_type.csv with or yyyymmddhhiissmd5hahstype.csv if --no-underscores is indicated\n");
}
$oldname = $argv[1];
$type = $argv[2];
$glue = empty($argv[3]) || $argv[3] != "--no-underscores" ? "_" : "";
$newname = date('YmdHis'). $glue . md5_file($oldname) . $glue . $type . '.csv';
#include <unistd.h>
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define N 5
void pexit(char *error) {
perror(error);
@dsueiro
dsueiro / Command
Created September 25, 2015 11:15
Sorting subsections in vim
:g/^a/+1,/^\s*$/-1 sort n