Skip to content

Instantly share code, notes, and snippets.

View m-radzikowski's full-sized avatar

Maciej Radzikowski m-radzikowski

View GitHub Profile
@m-radzikowski
m-radzikowski / RepareGrub2OnOpenSuse.sh
Created February 20, 2014 14:17
Script to restore Grub2 for openSUSE after for example Windows installation.
#!/bin/sh
# openSUSE rescue system login: root
fdisk -l
mount /dev/sda5 /mnt # assume that linux partition (/) is on /dev/sda5, you can see this after "fdisk -l" command
mount --bind /dev /mnt/dev
mount --bind /sys /mnt/sys
mount --bind /proc /mnt/proc
chroot /mnt
grub2-mkconfig -o /boot/grub2/grub.cfg
grub2-install /dev/sda
<?php
/**
* Twig Filter for Symfony 2 - check if asset exists.
*
* Modified Alain's Tiemblo code: http://stackoverflow.com/a/16906315/2512304
*
* Installation:
* 1. Add this file to your bundle into src/Acme/DemoBundle/Twig/AssetExistsExtension.php
* 2. Update namespace, if your bundle isn't Acme/DemoBundle
* 3. Register it in app/config.yml:
@m-radzikowski
m-radzikowski / TruncateHtmlExtension.php
Created July 2, 2013 19:13
Twig Filter for Symfony 2 - truncate HTML string without stripping tags after reach the minimum length of displayed text
<?php
/**
* Twig Filter for Symfony 2 - truncate HTML string without stripping tags after reach the minimum length of displayed text
* Truncates only first-level tags after reach the minimum, so returned text will be >= minimum
* Works well with (only?) utf-8 encoding.
*
* Installation:
* 1. Add this file to your bundle into src/Acme/DemoBundle/Twig/TruncateHtmlExtension.php
* 2. Update namespace, if your bundle isn't Acme/DemoBundle
* 3. Register it in app/config.yml: