Skip to content

Instantly share code, notes, and snippets.

@robi09
robi09 / example.js
Created September 12, 2013 19:10
Welcome to your first Gist! Gists are simple code reminders. Whenever you come across a piece of code you think might be useful later on, save it as a Gist. With GistBox, you can also tag the Gist with a label. This is especially useful for keeping them organized by language, project or purpose. For more info about GistBox, visit: http://www.gi…
// log an object to the browser console
console.log({ text: "foobar" });
<?php
/*
* Resize images dynamically using wp built in functions
* Victor Teixeira
*
* php 5.2+
*
* Exemplo de uso:
*
* <?php
cd ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/
git clone git://github.com/wbond/sublime_package_control.git Package\ Control
cd Package\ Control
git checkout python3
# restart Sublime Text 3 and you should have Package Control working

An ongoing project to catalogue all of these sneaky, hidden, bleeding edge selectors as I prepare my JSConf EU 2012 talk.

Everything is broken up by tag, but within each the selectors aren't particularly ordered.

I have not tested/verified all of these. Have I missed some or got it wrong? Let me know. - A

A friendly reminder that you may need to set this property on your target/selected element to get the styling results you want:

-webkit-appearance:none;

@robi09
robi09 / gist:178511def1a6c3bd46ae
Created October 14, 2015 09:19
WordPress - Get text domain function
/**
* Get text domain
*/
if(!function_exists('get_textdomain')) {
function get_textdomain() {
$default_headers = array( 'td' => 'Text Domain');
$text_domain = get_file_data(get_stylesheet_uri(), $default_headers );
if(array_key_exists('td', $text_domain)) {
return $text_domain['td'];
@robi09
robi09 / gist:3b22229a615ab519dcbf
Created October 28, 2015 11:00
Get woocommerce pages links
//Shop page URL
$shop_page_url = get_permalink( woocommerce_get_page_id( 'shop' ) );
//My Account URL
$myaccount_page_id = get_option( 'woocommerce_myaccount_page_id' );
if ( $myaccount_page_id ) {
$myaccount_page_url = get_permalink( $myaccount_page_id );
}
//Cart URL
@robi09
robi09 / gist:37e4cfd5f9dc42d8eed3
Created October 29, 2015 09:36
get latest page by template
function get_pages_by_template($template, $count = 1) {
$pages = get_pages(array(
'meta_key' => '_wp_page_template',
'meta_value' => $template,
'number' => $count
));
$return = array();
foreach($pages as $page){
@robi09
robi09 / woocommerce_ajax_variation_threshold.php
Last active June 9, 2016 08:29
WooCommerce Variation Ajax Threshold
add_filter( 'woocommerce_ajax_variation_threshold', 'woocommerce_ajax_variation_threshold', 10, 2 );
function woocommerce_ajax_variation_threshold( $qty, $product ) {
return 10000;
}
@robi09
robi09 / woocommerce_available_variation.php
Created November 9, 2015 08:19
WooCommerce display variation same price
add_filter('woocommerce_available_variation', , 10, 3);
function woocommerce_Variable_same_price($value, $object = null, $variation = null) {
if ($value['price_html'] == '') {
$value['price_html'] = '<span class="price">' . $variation->get_price_html() . '</span>';
}
return $value;
}
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#