Skip to content

Instantly share code, notes, and snippets.

@fprochazka
fprochazka / LookoutControl.php
Created October 15, 2010 10:41
LookoutControl - Control with fake life cycle
<?php
namespace Kdyby\Control;
use Nette;
use Nette\String;
class LookoutControl extends Nette\Application\Control

Sass/Less Comparison

In this document I am using Sass's SCSS syntax. You can choose to use the indented syntax in sass, if you prefer it, it has no functional differences from the SCSS syntax.

For Less, I'm using the JavaScript version because this is what they suggest on the website. The ruby version may be different.

Variables

@fprochazka
fprochazka / PresenterInfo.php
Created November 19, 2010 01:00
PresenterTree
<?php
namespace Kdyby;
use Nette;
use Nette\Reflection\ClassType;
/**
@orlin
orlin / Guardfile
Created December 6, 2010 13:08
CoffeeScript + Jim bundles / Guard
guard 'coffeescript', :output => 'app/javascripts', :wrap => false, :shallow => false do
watch('^app/coffeescripts/(.*)\.coffee')
end
def jimify(bundles, why = nil)
bundles = Array(bundles)
message = "Jim bundle & compress (bundles: #{bundles.join(", ")})"
message += " due to #{why} change" if why
puts message
# just bundle them first, so that livereload happens faster
@therobot
therobot / lets
Created December 23, 2010 14:46 — forked from afgomez/lets.sh
#!/bin/bash
# lets. A productivity booster
# based on ideas from https://gist.github.com/605292
#
# Copy your /etc/hosts to /etc/hosts.play and create a new one called /etc/hosts.work with a list of blocked sites
# Usage: sudo lets [play|work]
if [ $# = 0 ]
then
@Aurielle
Aurielle / BasePresenter.php
Created January 18, 2011 19:33
Koncept n:if-allowed (ověřování ACL v šablonách - Nette Framework) - funkční pouze s n:href
<?php
/*
* Předpokládá ACL následujícího tvaru:
* resource: Jméno presenteru / komponenty (PHP, včetně namespace)
* privilege: Jméno akce / signálu
*/
public function userAllowed($component, $destination = NULL)
{
if($destination === NULL) // No destination specified, can cause unexpected results when used with n:if-allowed as it would check for previous link!
@fprochazka
fprochazka / whereCalled.php
Created April 12, 2011 11:05
Shows where was method called
<?php
function wc($level = 1) {
if (\Nette\Debug::$productionMode) { return; }
$o = function ($t) { return (isset($t->class) ? htmlspecialchars($t->class) . "->" : NULL) . htmlspecialchars($t->function) . '()'; };
$f = function ($t) {
$file = defined('APP_DIR') ? 'app' . str_replace(realpath(APP_DIR), '', realpath($t->file)) : $t->file;
return '<a href="' . \Nette\DebugHelpers::editorLink($t->file, $t->line) . '">' . htmlspecialchars($file) . ':' . (int)$t->line . '</a>';
};
<?php
/**
* @see https://github.com/HosipLan/Nette-addDynamic
*/
class CreatePresenter extends BasePresenter
{
protected function startup()
{
<?php
namespace Kdyby\Loaders;
use Doctrine;
class DoctrineLoader
{
@VonC
VonC / .gitconfig
Last active May 19, 2018 08:51
My global git config
[user]
name = VonC
email = vonc@laposte.net
[core]
; just making sure those eol's stay as they are
autocrlf = false
; see http://stackoverflow.com/a/22208863/6309 (Git/Bash is extremely slow in Windows 7 x64, until fix in msysgit 1.9.4)
fscache = true
[alias]
; from http://www.jukie.net/bart/blog/pimping-out-git-log, with author displayed