Skip to content

Instantly share code, notes, and snippets.

View neo22s's full-sized avatar

Chema neo22s

View GitHub Profile
@neo22s
neo22s / .htaccess
Created September 11, 2015 10:37
.htaccess
# ----------------------------------------------------------------------
# Better website experience for IE users
# ----------------------------------------------------------------------
# Force the latest IE version, in various cases when it may fall back to IE7 mode
# github.com/rails/rails/commit/123eb25#commitcomment-118920
# Use ChromeFrame if it's installed for a better experience for the poor IE folk
<IfModule mod_setenvif.c>
<IfModule mod_headers.c>
@neo22s
neo22s / security.php
Created July 31, 2015 16:56
License for noahs
<?php
function authenticate( $fromLogin=FALSE )
{
global $gorumuser, $gorumroll, $gorumauthlevel, $gorumrecognised;
global $autoLogout, $autoLogoutTime, $cookiePath, $testauth, $now;
global $dontSetLastClickTime, $includeGuestsInCurrentlyOnline;
@neo22s
neo22s / ipdetails.php
Created July 29, 2015 17:20
Get ip geo info using 3rd party API's
die(print_r(ip_details("8.8.8.8")));
function ip_details($ip)
{
//list of providers to return IP information for free
$providers = array( 'ipinfo' => array('url' => "http://ipinfo.io/{$ip}/json",
'country_code' => 'country',
'country' => 'country',
'city' => 'city',
'region' => 'region',
@neo22s
neo22s / export.php
Created July 23, 2015 16:12
export noahs database into a CSV file to import at Open Classifieds
<?
set_time_limit(0);
ini_set('memory_limit', '1024M');
include("initdirs.php");
include(NOAH_APP . "/config.php");
include(NOAH_APP . "/constants.php");
@neo22s
neo22s / backup.sh
Created July 20, 2015 11:30
FTP Backup for MySQL and Files
#################
# FTP Backup Script
# Backup for files and MySQL, uploads to FTP and deletes old files.
# Chema@garridodiaz.com
# 2013-08-26
# GPLv3
#################
#################
@neo22s
neo22s / aws-backup.sh
Last active March 12, 2021 01:55
Backup for AWS, uploads to FTP and deletes old files.
#################
# FTP AWS Backup Script
# Backup for AWS, uploads to FTP and deletes old files.
# chema@yclas.com
# You need to install AWS CLI read more here http://martinbuberl.com/blog/backup-amazon-s3-bucket-with-aws-cli/
# 2015-07-20
# GPLv3
#################
@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[@]}"