Skip to content

Instantly share code, notes, and snippets.

@Onasusweb
Onasusweb / 0_reuse_code.js
Created January 9, 2014 04:51
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Le styles -->
<link href="../bootstrap/css/bootstrap.css" rel="stylesheet">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.js"></script>
</head>
<body>
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Le styles -->
<link href="../bootstrap/css/bootstrap.css" rel="stylesheet">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.js"></script>
</head>
<body>
// Prestashop 1.5.2, controllers/front/AuthController.php, line 278
$customer = new Customer();
$authentication = $customer->getByEmail(trim($email), trim($passwd));
if (!$authentication || !$customer->id)
{
// Handle brute force attacks
sleep(1);
$this->errors[] = Tools::displayError('Authentication failed');
}
<?php
/**
* Database Factory
* Use this factory for connections to external databases
*
* @version 1.0.0
* @author Julien BREUX <julien.breux@prestashop.com>
*/
class DbFactoryCore
{
<?php
/*
* 2007-2013 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
<?php
/*header("Content-type: text/csv");
header("Content-Disposition: attachment; filename=file.csv");
header("Pragma: no-cache");
header("Expires: 0");
*/
function friendly_url($nadpis) {
$url = $nadpis;
$url = preg_replace('~[^\\pL0-9_]+~u', '-', $url);
<?php
if (!defined('_PS_VERSION_')) exit;
class TD_Shortcode extends Module {
protected static $initialized = false;
public function __construct() {
$this->name = 'td_shortcode';
$this->tab = 'front_office_feature';
<?php
require_once _PS_MODULE_DIR_ . 'sfadvancedmailer/models/Client.php';
/**
*
* @author Christophe Willemsen
*/
class SfAdvancedMailer extends Module {
@Onasusweb
Onasusweb / MySQL.php
Last active August 29, 2015 14:13 — forked from dmalykh/MySQL.php
<?php
class MySQL extends Db {
public $logRoute;
private $_cache_list;
private $_tables;
private $_enableFileCache = false;
private $_not_cached = array(
"cart"
);