Skip to content

Instantly share code, notes, and snippets.

View vmattila's full-sized avatar

Ville Mattila vmattila

View GitHub Profile
@vmattila
vmattila / gist:8109af896a85595b85cb
Created June 2, 2014 01:38
A country field type that maintains the preferred_choices order
<?php
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
class PreferredChoicesMaintainingCountryType extends AbstractType
{
public function buildView(FormView $view, FormInterface $form, array $options)
@vmattila
vmattila / developr_fileupload.html
Created March 8, 2013 13:14
This gist includes test code for a possible bug in co-operation between Developr theme and https://github.com/blueimp/jQuery-File-Upload
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!-- Developr modernizer -->
<script type="text/javascript" src="/js/libs/modernizr.custom.js"></script>
<!-- Developr jQuery 1.8.2 -->
@vmattila
vmattila / test_case_output.txt
Created January 6, 2013 11:56
A short snippet of test case & it's output regarding WPML's behavior in wp_update_term() function. Relates to question in http://wpml.org/forums/topic/updating-a-term-with-wp_update_term-causes-a-new-translation-created/ .
Inserted FI: Array
(
[term_id] => 171
[term_taxonomy_id] => 176
)
trid after FI: 121
Inserted EN: Array
(
@vmattila
vmattila / wpml-page-content.php
Created September 10, 2012 19:20
WP Shortcode to show page contents (WPML enabled)
/**
* Usage: [wpml_page_content id=100]
* id attribute can be the id of any translation.
*/
function wpml_page_content_shortcode_handler( $atts, $content = null ) {
extract( shortcode_atts( array(
'id' => null,
), $atts ) );
// Here we'll hook with WPML functions and change the id to current language
@vmattila
vmattila / gist:1427167
Created December 3, 2011 13:49
Xsession init script to calibrate Wacom's tablet
#!/bin/sh
# This script is added to /etc/X11/Xsession.d/
# as /etc/X11/Xsession.d/10-calibrate-wacom for example
/usr/bin/xsetwacom --set "Wacom ISDv4 93 Finger touch" Area 250 320 3600 3670
@vmattila
vmattila / blacklist-acer-wmi.conf
Created December 3, 2011 13:38
modprobe.conf file to avoid acer-wmi loading
# This file is placed into /etc/modprobe.d/ to avoid
# kernel to load acer-wmi module
blacklist acer-wmi