Skip to content

Instantly share code, notes, and snippets.

View neo22s's full-sized avatar

Chema neo22s

View GitHub Profile
@neo22s
neo22s / listing.php
Created May 15, 2015 11:14
listing.php
<?php defined('SYSPATH') or die('No direct script access.');?>
<?if (Model_Category::current()->loaded() AND Model_Category::current()->id_category!=1):?>
<?=View::factory('pages/ad/listing_overview')?>
<?else:?>
the HMTL you had before that loads categories
<?endif?>
Verifying I am +chema on my passcard. https://onename.com/chema
@neo22s
neo22s / FraudLabsPro.class.php
Last active August 29, 2015 14:20
Prevent Fraud on Stripe - FraudLabsPro PHP Example
<?php
class FraudLabsPro {
private $apiKey;
public function __construct($apiKey=''){
if(!preg_match('/^[A-Z0-9]{32}$/', $apiKey))
throw new exception('FraudLabsPro: Invalid API key provided.');
$this->apiKey = $apiKey;
}
@neo22s
neo22s / git.sh
Created April 27, 2015 15:14
git tabs for ubuntu
#bin/bash
folders=(folder1 /my/otherfolder/ /var/www/openclassifieds2/)
for i in "${folders[@]}"
do
foo+=(--tab -e "bash -c 'cd "$i";git pull;git status';bash")
done
gnome-terminal "${foo[@]}"
@neo22s
neo22s / update231.php
Created March 30, 2015 08:02
update to 2.3.1 from 2.1.8 for vince
<?php
/**
* HTML template for the install
*
* @package Install
* @category Helper
* @author Chema <[email protected]>
* @copyright (c) 2009-2014 Open Classifieds Team
* @license GPL v3
@neo22s
neo22s / csvarray.php
Last active August 29, 2015 14:16
CSV to Array
/**
* CSV file to array
* @param file $csv
* @param array $expected_header
* @param boolean $convert_object you want it returned as an object?
* @param string $delimiter
* @param string $enclosure
* @return array
*/
public function csv_to_array($csv,$expected_header=NULL,$convert_object = FALSE, $delimiter = "," , $enclosure = '"')
@neo22s
neo22s / update230.php
Last active August 29, 2015 14:11
update 2.3.0
<?php
/**
* HTML template for the install
*
* @package Install
* @category Helper
* @author Chema <[email protected]>
* @copyright (c) 2009-2014 Open Classifieds Team
* @license GPL v3
@neo22s
neo22s / config.conf
Created December 11, 2014 21:57
nginx config for Open Classifieds
server {
listen 80;
listen [::]:80;
server_name
yourdomain.com
;
root /var/www/openclassifieds;
proxy_set_header Host $host;
@neo22s
neo22s / validate.php
Last active October 18, 2020 02:25
validate domain name in PHP
<?
/**
* checks if a domain name is valid
* @param string $domain_name
* @return bool
*/
public static function domain_name($domain_name)
{
//FILTER_VALIDATE_URL checks length but..why not? so we dont move forward with more expensive operations
$domain_len = strlen($domain_name);
@neo22s
neo22s / update221.php
Created September 17, 2014 08:23
Update OC to 2.2.1
<?php
/**
* HTML template for the install
*
* @package Install
* @category Helper
* @author Chema <[email protected]>
* @copyright (c) 2009-2014 Open Classifieds Team
* @license GPL v3
*/