Skip to content

Instantly share code, notes, and snippets.

View ivan-ivanic-cm's full-sized avatar

Ivan Ivanić ivan-ivanic-cm

  • 10up
  • novi sad, serbia
  • 08:54 (UTC +01:00)
View GitHub Profile
@ivan-ivanic-cm
ivan-ivanic-cm / gist:3111679
Created July 14, 2012 14:42
Set custom keyboard layout
setxkbmap -symbols 'pc+yg+inet(evdev)+level3(ralt_alt)+level3(rwin_switch)+capslock(none)+level3(menu_switch)'
$e = new Exception;
var_dump($e->getTraceAsString());
@ivan-ivanic-cm
ivan-ivanic-cm / crontab-gui-app
Created June 7, 2012 14:29
Start gui application through crontab. Add 'export DISPLAY=:0 && '
0 3 * * * export DISPLAY=:0 && your_favorite_application
encoders:
Spoygg\ProfajlerBundle\Document\Profileuser: plaintext
services:
some_nice_handle_that_strikes_your_fancy:
class: Symfony\Bundle\DoctrineMongoDBBundle\Security\DocumentUserProvider
arguments: [@doctrine.odm.mongodb.document_manager, 'SpoyggProfajlerBundle:Profileuser', 'username']
...
providers:
document_provider:
id: some_nice_handle_that_strikes_your_fancy
...
@ivan-ivanic-cm
ivan-ivanic-cm / pull that embed out
Created May 31, 2012 17:38
Deleting embedded document from document, MongoDB shell with $pull
> use test_database
> var pu = db.Profileusers
> pu.find({"blocks.title":""}).toArray() // find in Profileusers collection all profile users that have a block which title is empty
[
{
"_id" : ObjectId("4fc73221c0cd99aba79c7b74"),
"blocks" : [
{
"_id" : ObjectId("4fc78936376ab08618000000"),
"title" : "", // <-- here is the incriminating element, it's gonna fly muaaahaaaaaaa-ha-ha-ha (evil_grin)
sudo gpasswd -a $USER www-data
@ivan-ivanic-cm
ivan-ivanic-cm / Vim kill blank lines
Created April 30, 2012 07:43
Delete all blank lines from file
:g/^$/d
@ivan-ivanic-cm
ivan-ivanic-cm / WP num of queries
Created April 26, 2012 06:41
Check number of queries made for WP page
<?php echo $wpdb->num_queries; ?> <?php _e('queries'); ?>. <?php timer_stop(1); ?> <?php _e('seconds'); ?>