Skip to content

Instantly share code, notes, and snippets.

@vaclavbohac
vaclavbohac / Homepage.default.phtml
Created August 10, 2010 12:24
Usage example of Gmaps component
{block content}
<div id="header">
<h1>It works!</h1>
<h2>Congratulations on your first Nette Framework powered page.</h2>
</div>
<div>
<p>{$message}</p>
<?php
/**
* Live Client Script
* support for live validation of Nette/Forms
*
* @version 0.8
* @author David Grudl, Radek Ježdík, Marek Dušek
* @package Nette\Extras\Live-Form-Validation
*
@vaclavbohac
vaclavbohac / default.phtml
Created July 17, 2010 13:20
AJAX Request from Google Closure Library to Nette Framework back-end
{block content}
<div id="header">
<h1>Integration of Nette Framework and Google Closure Library</h1>
<h2>Two most powerfull frameworks.</h2>
</div>
<div>
{snippet:list}
# In your test_helper.rb
class ActiveRecord::Base
mattr_accessor :shared_connection
@@shared_connection = nil
def self.connection
@@shared_connection || retrieve_connection
end
end
<?php
/**
* Form control for selecting date
*
* Internally holds date as DateTime instance which is also returned by getValue method
*
* @author Jan Tvrdík
*/
class DatePicker extends Nette\Forms\FormControl
{
@karmi
karmi / post-receive-deploy.rb
Created June 17, 2010 13:21
Example script to deploy a Rails application via Git post-receive hook
#!/usr/bin/env ruby
# Example script to deploy a Rails application via Git post-receive hook
#
# INSTALL
#
# $ curl http://gist.github.com/442106.txt -o post-receive
# $ mv post-receive path/to/to/your/repo.git/hooks/post-receive
# $ chmod +x post-receive
<?php
require 'Nette/loader.php';
require 'stringFluent.php';
$string = string("ahoj já jsem petr")->capitalize();
echo $string."\n";
echo $string->webalize();
<?php
namespace App\Controls;
class Foo extends \App\Basis\Control
{
}
@vaclavbohac
vaclavbohac / nf.sh
Created May 4, 2010 11:48
Nette skeleton
#!/bin/bash
# Vaclav Bohac (c) 2010
SCAFDIR=$HOME/repo/nette-scaffolding
if [ "$1" = "create" ]; then
shift
if [ ! -n "$1" ]; then
echo "You must specify a project name"
{block headcontent}
{foreach $js as $script}
<script type="text/javascript" src="{$basePath}/js/{$script}"></script>
{/foreach}
{foreach $css as $sheet}
<link rel="stylesheet" media="screen,projection,tv" href="{$basePath}/css/{$sheet}" type="text/css">
{/foreach}
{/block}
{block content}