Skip to content

Instantly share code, notes, and snippets.

View josedigital's full-sized avatar

alex rodriguez josedigital

View GitHub Profile
@josedigital
josedigital / gist:17afe1045ee7aa3c4dc2
Created April 10, 2015 00:54
create processwire page tree
// get department page tree
$pl = $this->modules->get("ProcessPageList");
$pl->set('id',$page->id);
echo $pl->execute();
<?php
$admin = $users->get('admin');
$admin->setOutputFormatting(false);
$admin->pass = 'yo12345'; // put in your new password
$admin->save();
@josedigital
josedigital / gist:caf587894ab2d87fef2f
Created August 1, 2014 18:31
watch stylus with jeet and rupture
stylus --watch -u jeet -u rupture styles.styl
@josedigital
josedigital / login.php
Last active August 29, 2015 14:04
pw login
<?php
/*
LOGIN
<? require("./includes/login.php");?>
LOGOUT
<a href="?logout=1">Logout</a>
*/
<?php
/**
* Front-end upload form example
* using ProcessWire Inputfields
*/
$sent = false;
$upload_path = $config->paths->assets . "files/.tmp_uploads/";
@josedigital
josedigital / alias.php
Last active August 29, 2015 14:04
drupal-like alias page
<?php
/**
* ALIAS CREATION
* add this to the home template - make sure home template has url segments enabled.
*
*
* $alias = $pages->get("title=alias");
* // echo $alias->children();
* foreach ($alias->children as $p) {
*
@josedigital
josedigital / gist:bbb6c1143a6e90781e83
Created July 9, 2014 00:51
php debugger to console - pw
<?php
function debug ($data) {
echo "<script>\r\n//<![CDATA[\r\nif(!console){var console={log:function(){}}}";
$output = explode("\n", print_r($data, true));
foreach ($output as $line) {
if (trim($line)) {
$line = addslashes($line);
echo "console.log(\"{$line}\");";
}
@josedigital
josedigital / simpleserver
Created June 18, 2014 15:03
creat simple server via terminal
python -m SimpleHTTPServer 8000
@josedigital
josedigital / authentication-for-single-file.php
Last active August 29, 2015 14:02
password protect single php file
<?php
// read more -> http://www.php.net/manual/en/features.http-auth.php
if (!isset($_SERVER['PHP_AUTH_USER']) || $_SERVER['PHP_AUTH_USER'] != 'foo' || $_SERVER['PHP_AUTH_PW'] != 'bar') {
header('WWW-Authenticate: Basic realm="My Realm"');
header('HTTP/1.0 401 Unauthorized');
echo 'Unauthorized';
exit;
}
?>
<?php
/**
* Front-end upload form example
* using ProcessWire Inputfields
*/
$sent = false;
$upload_path = $config->paths->assets . "files/.tmp_uploads/";