Skip to content

Instantly share code, notes, and snippets.

View graphis's full-sized avatar

Zsolt Sándor graphis

View GitHub Profile
<html>
<head>
<script type="text/javascript" charset="utf-8" src="jquery.js"></script>
<script type="text/javascript" charset="utf-8">
$(document).ready(function()
{
var cb = $('<div class="color"/>').appendTo('body');
var c1 = [255, 0, 0];
var c2 = [0, 255, 255];
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
CREATE TABLE IF NOT EXISTS `associates` (
`id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(64) NOT NULL,
`website` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
$(document).ready(function() {
$('form').live('submit', function()
{
var form = $(this);
var action = form.attr('action');
$.post(action, form.serialize(), function(response)
{
form.replaceWith(response);
mkdir ~/git/website.git && ~/git/cd website.git
git init --bare
mkdir ~/webapps/website
git config core.worktree /home/rafi/webapps/website ; NO TRAILING SLASH!!! Will screw up things real bad.
git config core.bare false
git config receive.denycurrentbranch ignore
; create a hook
cat > hooks/post-receive
#!/bin/sh
<?php
// Excerpt from bootstrap.php
Kohana::init(
array(
'base_url' => '/',
'index_file' => '', // Important
)
);
@graphis
graphis / request.php
Created October 4, 2012 20:47 — forked from biakaveron/request.php
Old-style Request->uri() for Kohana v3.2
<?php defined('SYSPATH') or die('No direct script access.');
class Request extends Kohana_Request {
public function uri(array $params = null)
{
if ($params === NULL)
{
return parent::uri();
}
@graphis
graphis / base.php
Created November 4, 2012 20:50 — forked from wondersloth/base.php
Kohana Page Rendering Scheme
<?php defined('SYSPATH') or die('No direct script access.');
abstract class Controller_SiteLayout_Base extends Controller {
public $template = 'layout/base/page';
public $auto_render = TRUE;
/**
* The before() method is called before your controller action.
@graphis
graphis / gist:4013780
Created November 4, 2012 21:05 — forked from ernestas/gist:1033461
KOstache layout in a layout
<?php defined('SYSPATH') or die('No direct script access.');
/**
* Mustache templates for Kohana.
*
* @package Kostache
* @category Base
* @author Jeremy Bush <[email protected]>
* @author Woody Gilk <[email protected]>
* @copyright (c) 2010-2011 Jeremy Bush
* @copyright (c) 2011 Woody Gilk
<?php defined('SYSPATH') or die('No direct script access.');
class Controller_Example extends Controller {
public function action_index()
{
$this->request->response = new View_Example;
// or $this->response->body(new View_Example); in K3.1
}
@graphis
graphis / kostache-layout.php
Created November 4, 2012 21:11 — forked from lukemorton/kostache-layout.php
Basic HTML5 Mustache layout
<?php defined('SYSPATH') or die('No direct script access.');
class Kostache_Layout extends Kohana_Kostache_Layout {
public $app_id;
public $page_id;
public function charset()
{