Skip to content

Instantly share code, notes, and snippets.

ragulka

Block or report user

Report or block ragulka

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ragulka
ragulka / functions.php
Created Mar 10, 2017
Add custom fields to PDF Product Vouchers
View functions.php
<?php
// add custom voucher fields - see: https://cl.ly/323U011F0C2u
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
ragulka / convert.php
Created Sep 5, 2016
Convert Dashlane Export CSV to a 1Password compatible CSV
View convert.php
<?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
ragulka / index.html
Last active Aug 29, 2015
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
ragulka / gist:10458018
Last active Aug 29, 2015
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) {
client
.execute(function() {
return $('ul li').length;
}, [], function (err, result) {
result.value.must.eql(4);
@ragulka
ragulka / gist:6412932
Created Sep 2, 2013
Use CSS Specifity calculator (https://github.com/keeganstreet/specificity) to get the applied CSS rule for an element. Based on http://jsfiddle.net/markcoleman/TKHpV/5/ and http://jsfiddle.net/5Cyy3/ 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
* http://www.w3.org/TR/css3-selectors/#specificity
*
* 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
ragulka / jquery.ui.popover.js
Created Mar 26, 2012
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,
You can’t perform that action at this time.