Skip to content

Instantly share code, notes, and snippets.

View josedigital's full-sized avatar

alex rodriguez josedigital

View GitHub Profile
@josedigital
josedigital / gist:3177545
Created July 25, 2012 17:58
HTML: html starter page
<!doctype html>
<!--[if lt IE 7 ]><html class="ie ie6" lang="en"> <![endif]-->
<!--[if IE 7 ]><html class="ie ie7" lang="en"> <![endif]-->
<!--[if IE 8 ]><html class="ie ie8" lang="en"> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!--><html lang="en"> <!--<![endif]-->
<head>
<!-- Basic Page Needs
================================================== -->
<meta charset="utf-8" />
@josedigital
josedigital / ModuleName.module
Created July 25, 2012 18:05 — forked from somatonic/ModuleName.module
ProcessWire Module Template
<?php
/**
* ProcessWire Module Template
*
* Demonstrates the Module interface and how to add hooks.
*
* ProcessWire 2.x
* Copyright (C) 2010 by Ryan Cramer
* Licensed under GNU/GPL v2, see LICENSE.TXT
@josedigital
josedigital / ShibbolethLogin.module
Created July 25, 2012 18:06
Login Module Shibboleth
<?php
/**
* ProcessWire Module Template
*
* Demonstrates the Module interface and how to add hooks.
*
* ProcessWire 2.x
* Copyright (C) 2010 by Ryan Cramer
* Licensed under GNU/GPL v2, see LICENSE.TXT
<?php
$out = '';
// create a new form field (also field wrapper)
$form = $modules->get("InputfieldForm");
$form->action = "./";
$form->method = "post";
$form->attr("id+name",'subscribe-form');
<?php
/**
* Front-end upload form example
* using ProcessWire Inputfields
*/
$sent = false;
$upload_path = $config->paths->assets . "files/.tmp_uploads/";
@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;
}
?>
@josedigital
josedigital / simpleserver
Created June 18, 2014 15:03
creat simple server via terminal
python -m SimpleHTTPServer 8000
@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 / 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) {
*
<?php
/**
* Front-end upload form example
* using ProcessWire Inputfields
*/
$sent = false;
$upload_path = $config->paths->assets . "files/.tmp_uploads/";