This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Kdyby\Control; | |
use Nette; | |
use Nette\String; | |
class LookoutControl extends Nette\Application\Control |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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>'; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @see https://github.com/HosipLan/Nette-addDynamic | |
*/ | |
class CreatePresenter extends BasePresenter | |
{ | |
protected function startup() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Kdyby\Loaders; | |
use Doctrine; | |
class DoctrineLoader | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import datetime | |
from pyquery import PyQuery as pq | |
doc = pq(url='http://www.jinakrajina.cz/cz/poledni-menu') | |
noms = doc.find('td > p') | |
print '\n%s'%noms[0].text_content()[2:] | |
for i,nom in enumerate(noms[1:-1:2],1): | |
print '[%d] %s'%(i,nom.text_content().strip()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export PS1="\u:\W $ " | |
#GIT bash by HABR (modified by Dundee) | |
export PSORIG="$PS1" | |
function GITBRANCH() { | |
BRANCH="$(git branch 2>/dev/null | grep '*' | cut -d" " -f2-)" | |
if [ -n "$BRANCH" ] ; then | |
export PS1="\u:\W " | |
export PS1=$PS1$(echo -en "\[\033[00;37m\]$BRANCH \[\033[00m\]") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# inconsistent | |
# behavior in a class | |
class A | |
foo: -> | |
el.addEventListener 'click', @bar | |
bar: => | |
# the class instance, ideal but a special case for the fat arrow | |
console.log(@) |
OlderNewer