Skip to content

Instantly share code, notes, and snippets.

ragulka / functions.php
Created March 10, 2017 07:19
Add custom fields to PDF Product Vouchers
View functions.php
// add custom voucher fields - see:
add_filter( 'wc_pdf_product_vouchers_voucher_fields', 'my_voucher_fields' );
function my_voucher_fields( $fields ) {
$fields['my_property'] = array(
'data_type' => 'property',
'label' => __( 'My property', 'my-plugin' ),
ragulka / convert.php
Created September 5, 2016 07:44
Convert Dashlane Export CSV to a 1Password compatible CSV
View convert.php
// Place this file in th same directory with your Dashlane Export.csv
// and run using the following command in your Terminal:
// php convert.php
// This will create a file named fixed.csv, which should work for
// 1Password 6 import. In addition to moving fields into correct places,
// this will also try to remove hashed lines {...}, as well as lines where
ragulka / index.html
Last active August 29, 2015 13:59
Log browser javascript errors in Selenium tests with camme/webdriverjs
View index.html
<!-- In your HTML
We need to catch errors globally.
This example shows how to do it on test environment only, in EJS on node.js.
The principle remains the same regardless of backend or templating language
<% if (env === 'test') { %>
<!-- Error logging for selenium -->
<script type="text/javascript">
"use strict";
ragulka / gist:10458018
Last active August 29, 2015 13:59
Injecting and executing Javascript in Selenium tests using camme/webdriverjs
View gist:10458018
// This snippets shows how you can inject and execute Javascript in your Selenium tests using camme/debriverjs.
// This particular example uses jQuery to get the count of list-item elements on the page and returns it.
// In the callback you can then access the returned value as `result.value`
it('must have 4 list-item elements', function (done) {
.execute(function() {
return $('ul li').length;
}, [], function (err, result) {
ragulka / gist:6412932
Created September 2, 2013 13:36
Use CSS Specifity calculator ( to get the applied CSS rule for an element. Based on and Basically, this is window.getMatchedCSSStyles for all browsers, plus the extra benefit of actually getting the applied rule. For example, you can d…
View gist:6412932
* Calculates the specificity of CSS selectors
* Returns an array of objects with the following properties:
* - selector: the input
* - specificity: e.g. 0,1,0,0
* - parts: array with details about each part of the selector that counts towards the specificity
var SPECIFICITY = (function() {
View tokenfield-typeahead.css
.twitter-typeahead .tt-hint {
border: 0;
padding: 0;
.tt-dropdown-menu {
min-width: 160px;
margin-top: 2px;
padding: 5px 0;
background-color: #fff;
ragulka / jquery.ui.popover.js
Created March 26, 2012 18:37
Popover widget for jQuery UI
View jquery.ui.popover.js
(function($, undefined) {
var uiPopoverClasses = 'ui-popover ';
var openPopover = null;
$.widget("ui.popover", {
// Default options
options: {
offsetX: 0,