Skip to content

Instantly share code, notes, and snippets.

View favrik's full-sized avatar
🏀

Favio Manriquez favrik

🏀
View GitHub Profile
@favrik
favrik / localhost-vhost
Created May 10, 2011 20:17
vhost for localhost
<VirtualHost *:80>
DocumentRoot "/Library/WebServer/Documents"
<Directory />
Options All
AllowOverride All
Order deny,allow
Deny from All
Allow from 127.0.0.1
</Directory>
@favrik
favrik / staticx.php
Created June 6, 2011 11:12
A CodeIgniter controller used for static sites
<?php
class Staticx extends CI_Controller {
/**
* This action must be configured as a "catch-all" url inside
* application/config/routes.php You can do this by adding the following
* line to that file:
*
* $route['(:any)'] = 'staticx/route/$1';
@favrik
favrik / routes.php
Created June 6, 2011 11:16
application/config/routes.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
| -------------------------------------------------------------------------
| URI ROUTING
| -------------------------------------------------------------------------
| This file lets you re-map URI requests to specific controller functions.
|
| Typically there is a one-to-one relationship between a URL string
| and its corresponding controller class/method. The segments in a
| URL normally follow this pattern:
@favrik
favrik / layout.php
Created June 6, 2011 11:16
application/views/layout.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="keywords" content="<?php echo $meta_keywords ?>" />
<title>My Static Site - <?php echo $page_title ?></title>
</head>
<body>
<h1><?php echo $page_title ?></h1>
@favrik
favrik / holidays.php
Created June 6, 2011 11:24
Example view file with meta data in the initial php comments
<?php
/*
Page Title: My DF holidays
Meta Keywords: df, holidays, mine
*/
?>
<p>
This is some nice test content.
@favrik
favrik / post-commit.php
Created August 13, 2011 01:54
Beanstalk post-commit hook script that sends an email if a specific file was modified
<?php
$SEND_NOTIFICATION = FALSE;
$watched_file = 'file/to/watch/in_your_repository';
/*----------------------------------------------------------*/
if (isset($_POST['commit'])) {
require 'JSON.php'; // PECL script, or perhaps json_decode() is enough
@favrik
favrik / hah.js
Created December 5, 2011 00:49
Why .apply is awesome
// Set container height to highest list
var heights = $('.articleSection').map(function() {
return $(this).innerHeight();
}).get();
console.log(heights);
var max = Math.max.apply(Math, heights);
//$('.articlesWidget .wrapper').height(max);
@favrik
favrik / header.inc.php
Created January 27, 2012 21:52
SITIO BASICO 1era Parte: Como crear un simple sistema de plantillas para sitios web muy basicos.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head profile="http://www.w3.org/2005/10/profile">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="icon" type="image/png" href="favicon.ico">
<link rel="stylesheet" type="text/css" href="css/style.css" />
<link rel="stylesheet" type="text/css" href="css/footer.css" />
<!--[if lt IE 7]>
<link rel="stylesheet" type="text/css" href="css/ie7footer.css" />
<![endif]-->
@favrik
favrik / footer.inc.php
Created January 27, 2012 21:56
SITIO BASICO 2da Parte
@favrik
favrik / index.php
Created January 27, 2012 21:58
SITIO BASICO 3ra Parte
<?php
$page_title = 'Mi Pagina Web';
require 'header.inc.php';
?>
<h1>Encabezado principal</h1>
<p>Informacion</p>