Skip to content

Instantly share code, notes, and snippets.

@rutger1140
rutger1140 / list.php
Created November 18, 2013 16:36
List urls from Mathias Bynens URL shortener in a simple table. https://github.com/mathiasbynens/php-url-shortener
<?php
require('config.php');
$db = new mysqli(MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD, MYSQL_DATABASE);
$db->set_charset('utf8');
$result = $db->query('SELECT *, DATE(redirect.date) AS shortdate FROM redirect ORDER BY redirect.date DESC');
// If we have no results
if ($result && $result->num_rows < 0) die('No results');
@claudiosanches
claudiosanches / functions.php
Created January 9, 2014 16:32
WooCommerce 2.1 - Extra fields in WooCommerce registration.
<?php
/**
* Add new register fields for WooCommerce registration.
*
* @return string Register fields HTML.
*/
function cs_wc_extra_register_fields() {
?>
<p class="form-row form-row-first">
<label for="reg_billing_first_name"><?php _e( 'Nome', 'textdomain' ); ?> <span class="required">*</span></label>
@L422Y
L422Y / osx_automount_nfs.md
Last active December 6, 2025 17:55
Automounting NFS share in OS X into /Volumes

I have spent quite a bit of time figuring out automounts of NFS shares in OS X...

Somewhere along the line, Apple decided allowing mounts directly into /Volumes should not be possible:

/etc/auto_master (see last line):

#
# Automounter master map
#

+auto_master # Use directory service

var gulp = require('gulp');
// Get packages from package.json
var tasks = require("gulp-load-tasks")();
// Livereload stuff
lr = require('tiny-lr'),
server = lr();
@thagxt
thagxt / AJAX add to cart button on Shop page in WooCommerce.php
Created April 3, 2014 14:27
AJAX add to cart button on Shop page in WooCommerce
WTF: Get the AJAX add to cart button on Shop/Category/Search pages in WooCommerce. (AJAX works only for simple products)
HOW:
1) create a directory, name it "woocommerce" put it in your theme root.
2) copy/pasta from woocommerce plugin directory the content-product.php file
3) at the end of the (content-product.php) file, paste the code below:
<?php
global $product;
echo apply_filters( 'woocommerce_loop_add_to_cart_link',
@Eworm
Eworm / .scss-lint.yml
Last active August 29, 2015 14:01
SCSS lint preferences
linters:
Indentation:
enabled: true
width: 4
EmptyRule:
enabled: false
PropertySortOrder:
@Eworm
Eworm / gulpfile.js
Created June 1, 2014 07:48
Gulpfile with SCSS lint
var gulp = require('gulp');
// Get packages from package.json
var plugins = require("gulp-load-plugins")();
// Livereload stuff
lr = require('tiny-lr'),
server = lr();
@staltz
staltz / introrx.md
Last active December 31, 2025 13:31
The introduction to Reactive Programming you've been missing
@pommiegranit
pommiegranit / base.twig
Last active May 31, 2021 18:50
Timber + Twig Examples
{% import 'twig/macros.twig' as macros %}
{{ function( 'get_header' ) }}
<div id="primary" class="content-area">
<div id="main" class="site-main" role="main">
{% block content %}{% endblock %}
</div><!-- #main -->
<?php
/**
* Plugin Name: WooCommerce Settings Tab Demo
* Plugin URI: https://gist.github.com/BFTrick/b5e3afa6f4f83ba2e54a
* Description: A plugin demonstrating how to add a WooCommerce settings tab.
* Author: Patrick Rauland
* Author URI: http://speakinginbytes.com/
* Version: 1.0
*
* This program is free software: you can redistribute it and/or modify