Skip to content

Instantly share code, notes, and snippets.

>rails new demo
create
create README.rdoc
create Rakefile
create config.ru
create .gitignore
create Gemfile
create app
create app/assets/images/rails.png
create app/assets/javascripts/application.js
@Jragon
Jragon / gist:3751850
Created September 19, 2012 19:54
PHP alt sytax
<html>
<head>
<title><?=$title; ?></title>
</head>
<body>
<? if($loggedIn = true): ?>
<p>You're logged in!</p>
<? else: ?>
<p>You're not logged in!</p>
<? endif; ?>
@Jragon
Jragon / gist:3751875
Created September 19, 2012 19:58
Braces syntax
<html>
<head>
<title>{$title}</title>
</head>
<body>
{if ($loggedIn = true)}
<p>You're logged in!</p>
{else}
<p>You're not logged in!</p>
</body>
#include "SDL/SDL.h"
#include "SDL/SDL_image.h"
#include <string>
// screen atributes
const int SCREEN_WIDTH = 640;
const int SCREEN_HEIGHT = 480;
const int SCREEN_BPP = 32;
// surfaces
@Jragon
Jragon / gist:4137277
Created November 23, 2012 20:55
Post quick asign
$username = NULL;
$password = NULL;
$email = NULL;
foreach($_POST as $key => $var){
$$key = $var;
}
<?php
class Admin extends Controller{
function __construct(){
var_dump($this->load);
$this->load->model("admin/admin.php");
}
<?php
class Welcome extends Controller{
public function index(){
var_dump($this->load);
$this->load->model('welcome');
$data = array('title' => 'Hellow', 'greeting' => $this->welcome->greeting);
$this->load->view('welcome/index', $data);
}
}
<?php
class Controller{
function __construct(){
global $config;
$this->load = new Load($this);
}
}
<?php
class Controller{
function __construct(){
global $config;
$this->load = new Load($this);
}
}
<?php
class Load{
function __construct($object){
$this->object = $object;
}
// loads a specified model
public function model($model){
$model = strtolower($model);