Skip to content

Instantly share code, notes, and snippets.

@mirzap
mirzap / auth.php
Created January 20, 2013 20:15 — forked from mwesten/auth.php
<?php
class Auth_Controller extends Base_Controller {
public $restful = true;
public function __construct() {
$this->filter( 'before', 'guest' )->except( array( 'logout', 'validate' ) );
// Note: We may not always require CSRF on login for system based logins so ignore it here.
$this->filter( 'before', 'csrf' )->on( 'post' )->except( array( 'login' ) );
}

There's no shortage of good resources for learning laravel. So instead of the usual introductory tutorial were just gonna learn Laravel by building a project from scratch and that's gonna be a User Management System.

I don't know if my definition of a User Management System is correct but here's my idea of what's it's capable of doing:

  • Register Roles
  • Register Users
  • Update Users
<?php
// Resizer and Image Manipulation
// Based on: http://forums.laravel.com/viewtopic.php?id=2648
public function post_edit_logo($id)
{
$rules = array(
'image' => 'image',
);
<?php
// Resizer and Image Manipulation
// Based on: http://forums.laravel.com/viewtopic.php?id=2648
public function post_edit_logo($id)
{
$rules = array(
'image' => 'image',
);
<?php
/**
* TestClass
*
* This is just a test class for the Annotated\ReflectionClass
* to use.
*
* Foo::bar();
*
<?php
//Product
class Report {
private $header;
private $body;
private $footer;
@mirzap
mirzap / rc4.js
Created March 11, 2013 21:42 — forked from farhadi/rc4.js
/*
* RC4 symmetric cipher encryption/decryption
*
* @license Public Domain
* @param string key - secret key for encryption/decryption
* @param string str - string to be encrypted/decrypted
* @return string
*/
function rc4(key, str) {
var s = [], j = 0, x, res = '';

##Objective

Add RESS for conditional content based on screen size. Accomplished by creating a JavaScript cookie

##Problem

When a cookie is set via JavaScript, Laravel's Cookie can't read the cookie. It doesn't work because there is no httpOnly option in Laravel. Symfony cookie does have httpOnly option but it defaults to TRUE. httpOnly has to be set to FALSE in order to access cookies from the browser. See issues:

<?php
/**
* post-process.php
* make sure to include post-process.php in your functions.php. Use this in functions.php:
*
* get_template_part('post-process');
*
*/
function do_insert() {
if( 'POST' == $_SERVER['REQUEST_METHOD']
<!DOCTYPE html>
<html>
<head>
<title>Box Shadow</title>
<style>
.box {
height: 150px;
width: 300px;
margin: 20px;