Skip to content

Instantly share code, notes, and snippets.

@sblmasta
sblmasta / nginx.conf
Created October 5, 2015 19:50 — forked from denys281/nginx.conf
Symfony2 nginx virtual host (php-fpm)
server {
listen 80;
# Server name being used (exact name, wildcards or regular expression)
server_name mysite.com;
client_max_body_size 20M;
# Document root, make sure this points to your Symfony2 /web directory
root /home/user/sites/mysite.com/web;
@sblmasta
sblmasta / collection_widget.twig
Last active September 11, 2015 16:20 — forked from cowlby/collection_widget.twig
Customizing form collections in Symfony2
{% block collection_widget %}
{% spaceless %}
<div class="collection">
{% if prototype is defined %}
{% set attr = attr|merge({'data-prototype': block('collection_item_widget') }) %}
{% endif %}
<div {{ block('widget_container_attributes') }}>
{{ form_errors(form) }}
<ul>
{% for rows in form %}
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin webmaster@zencode.pl
DocumentRoot "/Users/sbl/www"
ServerName localhost
ServerAlias localhost
ErrorLog "/Users/sbl/www/logs/error.log"
CustomLog "/Users/sbl/www/logs/access.log" common
@sblmasta
sblmasta / gist:5511ee1e91d3e80fea31
Created February 24, 2015 21:39
PHP 5.5 ./configure command
./configure --prefix=/opt/php/5.5 --with-pdo-pgsql --with-zlib-dir --with-freetype-dir --enable-mbstring --with-libxml-dir=/usr --enable-soap --enable-calendar --with-curl --with-mcrypt --with-gd --with-pgsql=/usr/lib/postgresql --disable-rpath --enable-inline-optimization --with-bz2 --with-zlib --enable-sockets --enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex --with-mhash --enable-zip --with-pcre-regex --with-mysql --with-pdo-mysql --with-mysqli --with-jpeg-dir=/usr --with-png-dir=/usr --enable-gd-native-ttf --with-openssl --with-fpm-user=www-data --with-fpm-group=www-data --with-libdir=lib --enable-ftp --with-imap=/usr/local/imap-2007f --with-imap-ssl --with-kerberos --with-gettext --with-xsl --enable-fpm --enable-opcache
$(function(){
$('.arrayToString input[type="checkbox"]').on('click', function(){
var t = $(this);
var inputData = $('#' + t.data('input'));
var list = inputData.val().split(',').filter(function() { return true; });
var value = t.val();
var elem = list.indexOf(value);
if( $(this).prop('checked') )
{
@sblmasta
sblmasta / ISPConfig_Postfixadmin.php
Created October 29, 2014 14:02
Convert mailboxes from ISPConfig postfix to Postfixadmin structure.
<?php
$db = new PDO('mysql:host=localhost;dbname=postfix;charset=utf8', 'root', 'admin');
$stmt = $db->query("SELECT * FROM mail_user");
foreach( $stmt->fetchAll(PDO::FETCH_ASSOC) as $row )
{
$email = $row['email'];
$login = explode('@',$email)[0];
$domain = explode('@',$email)[1];
<?php
namespace cms\entity;
class Category
{
protected $id;
protected $left = 0;
protected $right = 1;
$.fn.extend({
limitText: function(config){
$(this).after('<div id="counter">Limit znaków: <span></span></div>');
var limit = typeof(config.limit) == 'undefined' ? this.attr('maxlength') : config.limit;
var counter_hook = typeof(config.counter) == 'undefined' ? '#counter' : config.counter;
$(counter_hook).data('value', limit);
$(counter_hook).find('span').html(limit);
$factory = $this->get('security.encoder_factory');
$encoder = $factory->getEncoder($user);
$password = $encoder->encodePassword(TUTAJ_HASLO, TUTAJ_SALT);
@sblmasta
sblmasta / header.php
Last active December 31, 2015 12:38
WordPress navigation generator
<?php
$menu_name = 'main-primary-menu';
$locations = get_nav_menu_locations();
$menu = wp_get_nav_menu_object( 45 ); //wpisane na sztywno ID lokalizacji menu
$menu_items = wp_get_nav_menu_items($menu->term_id);
echo '<ul id="menu-'.$menu_name.'">';
echo '<li class="current_page_item"><a href="'.get_bloginfo('url').'">Strona Główna</a></li>';
foreach ( (array) $menu_items as $key => $menu_item )