Skip to content

Instantly share code, notes, and snippets.

View devuri's full-sized avatar

uri devuri

  • Mexico
View GitHub Profile
@devuri
devuri / url.php
Created October 9, 2017 17:37 — forked from cam-gists/url.php
PHP: Strict URL Validation
<?php
$url = 'http://example.com';
$validation = filter_var($url, FILTER_VALIDATE_URL, FILTER_FLAG_HOST_REQUIRED);
if ( $validation )
{
$output = 'proper URL';
}
else
{
@devuri
devuri / awesome-wp-config-file.php
Created October 19, 2017 15:31 — forked from ashfame/awesome-wp-config-file.php
awesome-wp-config-file
<?php
/**
* Define type of server
*
* Depending on the type other stuff can be configured
* Note: Define them all, don't skip one if other is already defined
*/
define( 'DB_CREDENTIALS_PATH', dirname( ABSPATH ) ); // cache it for multiple use
@devuri
devuri / wp-config.php
Created October 19, 2017 15:32 — forked from ifamily/wp-config.php
A universal WordPress wp-config.php which works on local development to staging and production server environments.
<?php
/*
One wp-config for local development to staging to production.
*/
// Define Environments
$environments = array(
@devuri
devuri / array_insert.php
Created October 21, 2017 08:44 — forked from scribu/array_insert.php
array_insert()
<?php
/**
* Insert an array into another array before/after a certain key
*
* @param array $array The initial array
* @param array $pairs The array to insert
* @param string $key The certain key
* @param string $position Wether to insert the array before or after the key
* @return array
@devuri
devuri / EDD Function Example.php
Created October 21, 2017 08:49 — forked from sunnyratilal/EDD Function Example.php
Example Easy Digital Downloads Function
<?php
/**
* Example function description
*
* @since {Next EDD Version}
* @param {array, string, int, objext} {$variable_name} {Short description}
* @return {array, string, int, mixed, object} {$variable_name} {Short description}
* {@internal Any To-Dos etc.}
*/
@devuri
devuri / awesome-php.md
Created October 30, 2017 16:20 — forked from ravinGit/awesome-php.md
Awesome PHP Libraries
@devuri
devuri / dosu.php
Created October 30, 2017 18:55 — forked from karthikax/dosu.php
PHP Download file to server from URL
<html>
<p style="width: 70%;margin: auto;margin-top: 5%;font-size:larger;text-align:center">
Download a file from any URL</p>
<form method="post" style="width: 70%;margin: auto;margin-top: 10%;">
<input name="url" size="50" placeholder="Source URL" style="width: 100%;height: 10%;font-size: 1.5em;padding:10px" required>
<input name="submit" type="submit" value="Download" style="width: 30%;height: 10%;margin: 5% auto; display: block;">
<p style="width: 70%;margin: auto;margin-top: 10%;font-size:larger;text-align:center">
To <?php echo getcwd(); ?></p>
<p style="width: 70%;margin: auto;font-size: smaller;text-align: center;position: fixed;bottom: 0;background: #fff;">
Powered by: <a href="http://kart.tk/portfolio" target="_blank" style="color:#f60;text-decoration:none;">Karthik</a></p>
@devuri
devuri / index.html
Created October 31, 2017 18:13 — forked from benjchristensen/index.html
Simple Line Graph using SVG and d3.js
<html>
<head>
<title>Simple Line Graph using SVG and d3.js</title>
<script src="http://mbostock.github.com/d3/d3.v2.js"></script>
<style>
/* tell the SVG path to be a thin blue line without any area fill */
path {
stroke: steelblue;
stroke-width: 1;
fill: none;
@devuri
devuri / example.php
Created November 1, 2017 01:32 — forked from tlongren/example.php
PHP Clean URL (SLUG) Generator
<?php
$slug = slugit("thank you for visiting");
echo $slug;
// returns: thank-you-for-visiting
?>
@devuri
devuri / gist:77e6df86cdb3633ec602e5992a023e71
Created December 5, 2017 16:48 — forked from bueltge/gist:6104254
A Look at the WordPress HTTP API: A Practical Example of wp_remote_get
<?php
/**
* Plugin Name: Twitter Demo
* Plugin URI: http://wp.tutsplus.com/tutorials/creative-coding/a-look-at-the-wordpress-http-api-a-practical-example-of-wp_remote_get/
* Description: Retrieves the number of followers and latest Tweet from your Twitter account.
* Version: 1.0.0
* Author: Tom McFarlin
* Author URI: http://tommcfarlin.com/
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt