Skip to content

Instantly share code, notes, and snippets.

View fprochazka's full-sized avatar
🏠
Working from home

Filip Procházka fprochazka

🏠
Working from home
View GitHub Profile
@lancejpollard
lancejpollard / less2stylus.coffee
Created February 9, 2012 19:33
Convert LESS to Stylus for Twitter Bootstrap
# Quick hack of regular expressions to convert twitter bootstrap from LESS to Stylus
less2stylus = (string) ->
string = string
.replace(/^(\ *)(.+)\ +\{\ *\n?\ */mg, "$1$2\n$1 ") # remove opening brackets
.replace(/^(\ *)([^\ \n]+)\ +\{\ *\n?\ */mg, "$1$2\n$1 ") # remove opening brackets
.replace(/\ *\{\ *\n*/g, "\n") # remove opening brackets again (some random cases I'm too lazy to think through)
.replace(/\ *\}\ *\n*/g, "\n") # remove closing brackets
.replace(/\;\ *?$/gm, "") # remove semicolons
.replace(/@(\w+):(\ *)\ /g, (_, $1, $2) -> # replace @variable: with $variable =
"$#{$1}#{$2} = "
@vojtech-dobes
vojtech-dobes / example.latte
Created September 10, 2011 00:37
Latte helpers for HTML 5 data-attributes
{* with helper *}
<div id="with-data" data-example="{[a => b]|data}"></div>
{* with macro *}
<div id="with-data" n:data="example, [a => b]"></div>
<script>
var data = parseDataJson($('#with-data'), 'example');
// => data == {a: 'b'}
</script>
@beberlei
beberlei / SQLFilter.php
Created July 21, 2011 10:46
First idea for SQL Filtering in Doctrine2
<?php
namespace Doctrine\ORM\Query\Filter;
abstract class SQLFilter
{
final public function __construct(Connection $conn);
final function setParameter($name, $value, $type);
@Aurielle
Aurielle / LanguageTable.php
Created February 3, 2011 16:59
LanguageTable - překladová tabulka pro Route s podporou gettextového překladače
<?php
/**
* Avalon CMS
*
* Copyright (c) 2010 Vaclav Vrbka (http://www.php-info.cz)
*/
namespace Avalon\Application;
use Avalon, Nette;
@Aurielle
Aurielle / WidgetContainer.php
Created January 12, 2011 15:57
WidgetContainer - spravuje widgety
<?php
/**
* PHP-in' CMS Framework
*
* Copyright (c) 2010 Vaclav Vrbka (http://www.php-info.cz)
*
* This source file is subject to the "PHP-in' CMS Framework licence".
* For more information please see http://www.phpin.eu
*/
@Mikulas
Mikulas / GravatarPresenter.php
Created December 5, 2010 13:59
Gravatar cache for nette
<?php
class GravatarPresenter extends \Nette\Application\UI\Presenter
{
public function actionDefault($email, $size = 80)
{
$this->sendResponse(new GravatarResponse($email, $size));
}
}
@pavelmaca
pavelmaca / backup.sh
Created November 13, 2010 13:29
backup.sh
#!/bin/bash
# My first shell script :)
# Backup domains directories and MySQL database.
clear
# CONFIGURATION
MODE_D="0740"
MODE_F="0640"
DAY=$(date +%F) # YYYY-MM-DD
@redhead
redhead / live-form-validation.js
Created August 26, 2010 21:16
Live Form Validation for Nette 2.0
/**
* Live Form Validation for Nette 2.0
*
* @author Radek Ježdík, MartyIX, David Grudl
*/
var LiveForm = {
options: {
controlErrorClass: 'form-control-error', // CSS class for an invalid control
errorMessageClass: 'form-error-message', // CSS class for an error message