Skip to content

Instantly share code, notes, and snippets.

View devuri's full-sized avatar

uri devuri

  • Mexico
View GitHub Profile
@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 / array-of-files.php
Created October 24, 2017 14:36
queue an array of files
<?php
//queue an array of files
que_files ($type = 'php', array()){
//call all files in the array use glob include
}
//example call: include functions.php dbconfig.php constants.php
@devuri
devuri / queue.php
Last active October 29, 2017 03:23
Include a list of files with que_files('dir','myfunctions','new-class', 'hello');
<?php
/**
* Call queue('includes','function', 'hello', 'php');
* Output : include_once(dir/hello.php);
* first param is the directory name
* second param list of files to include
**********************************************/
function queue(){
$files = func_get_args();
@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
@devuri
devuri / Backup.php
Created January 28, 2018 04:13 — forked from SahilC/Backup.php
Php Mysql Database backup and restore
<?php
$dump_path = ""; //input location for the backup to be saved
$host = ""; //db host e.g.- localhost
$user = ""; //user e.g.-root
$pass = ""; //password
$command=$dump_path.'mysqldump -h '.$host.' -u '.$user.' bank > bank.sql';
system($command);
?>