GithubHelp home page GithubHelp logo

code-samples's Introduction

Code Samples

A collection of code samples with descriptions and example usage.


Extends PHP's autoload_register function. Allows you to choose multiple directories to include your classes.

Setup / How To Use

By default, this class looks for classes by the name of the file(s). For example, if your class is named users then it will look for class.users.php.

NOTE: The paramater needs to be an absolute server path to the directory/directories.

$directories = array('/home/directory/public_html/app/modules/');
#autoload = new autoload($directories);

Downloads remote framework archive and unpacks contents.

Setup / How To Use

Option 1: Download custom archive, unpack, & create config file

$install = new installer();
$install->download('http://your-domain.com/framework.zip');
$install->unpack();
$cred = array(
	'DB_HOST' => 'localhost', 
	'DB_DATABASE' => 'user_db12', 
	'DB_USER' => 'user_kewl', 
	'DB_PASSWORD' => 'abc123456'
);
$install->create($cred, 'config.php');

Option 2: Download public archive & unpack

# Download and unzip Wordpress (or a framework of your choosing).

$install = new installer($url);
$install->download($install->framework['wordpress']);
$install->unpack();

Example script of pulling page content from database based on the URI. If the lookup of the page doesn't exist it will return an error 404 status code.


Simple PHP class for reCAPTCHA verification. Can be used to easily work into any framework, or by itself.

Get your SITE & SERVER KEY here: https://www.google.com/recaptcha/

Setup / How To Use

Server-side

require('class.recaptcha.php');
$recaptcha = new recaptcha('your_SITE_KEY', 'your_SECRET_KEY');		
if(!$recaptcha->response()):
	print 'Sorry, you failed the reCAPTCHA';
else:
	// All your form processing here.
endif;

Client-side

If possible, paste this snippet before the closing </head> tag.

$recaptcha->script();

Put this at the end of the form where you want the reCAPTCHA widget to appear.

$recaptcha->widget();

You can optionally add different parameters to the 'widget' method. Shown below.

$recaptcha->widget('dark', 'compact');
// 1st param - 'light' is default (light|dark)
// 2nd param - 'normal' is default (normal|compact)

Setup / How To Use

$url = new url_parser('https://main.google.com/?test=action');
print '<pre>';
print_r($url->url);
print '</pre>';

Example Output

Array(
    [scheme] => https
    [host] => main.google.com
    [path] => /
    [query] => test=action
)

Put a dancing cat on any website... because, why not? ¯\_(ツ)_/¯

Setup / How To Use

  1. Run the HTML file in your browser.
  2. Then click and drag the bookmarklet to your browser bookmark toolbar.
  3. ???
  4. Profit

Be notified of when there are error_log files on your server. Emails the locations of the error_log and the filesize. Run on a CRON to automate running the script.

code-samples's People

Contributors

andrewchamp avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.