Skip to content

Instantly share code, notes, and snippets.

View pabloselin's full-sized avatar

Pablo Selín Carrasco Armijo pabloselin

View GitHub Profile
@lstellway
lstellway / wordpress-json-postmeta-search.php
Created September 12, 2018 17:18
WordPress include wp_postdata meta fields in search query
<?php
/**
* Reference: https://websmartdesign.nz/searching-structured-post-data-with-wordpress/
* Make meta data searchable
*/
// Join wp_postmeta
add_filter('posts_join', function($join) {
global $wpdb;
@mixin for-phone-only {
@media (max-width: 599px) { @content; }
}
@mixin for-tablet-portrait-up {
@media (min-width: 600px) { @content; }
}
@mixin for-tablet-landscape-up {
@media (min-width: 900px) { @content; }
}
@mixin for-desktop-up {
@Luehrsen
Luehrsen / functions.php
Last active August 14, 2018 15:09
WordPress Responsive Embeds
/**
* Change the embed code, so we can apply awesome css classes
* Called by filter "oembed_result"
*
* @author Hendrik Luehrsen
* @since 1.0
*
* @param $html string The oembed html to edit
*
* @return string The edited html
@internationils
internationils / gandihost-sslcert.sh
Last active February 20, 2017 16:40
Create and apply Letsencrypt certificates to Gandi vhosts using certbot
#!/bin/sh
# ---------------------------------------------------------------------
# ---------------------------------------------------------------------
# sslgen-gandihosts.sh
#
# v04 - 2016-08-10 combibe create and update loop
# v03 - 2016-08-10 more cleanups
# v02 - 2016-08-04 lots of cleanups, improved loop for updates
# v01 - basic functionality
@jigpu
jigpu / wacom-gnome-compat.sh
Last active September 21, 2020 17:19
Script to remap pad buttons on consumer (Bamboo) Wacom devices to be compatible with GNOME
#!/bin/bash
# Consumer Wacom devices (i.e. most Bamboo devices like the Bamboo Pen & Touch,
# Bamboo Fun, Bamboo Connect; and the newer non-pro Intuos devices like the
# Intuos Draw and Intuos Art) have a hardware button mapping that is incompatible
# with GNOME. This incompatibility prevents the GNOME Control Center's Wacom panel
# from working properly, and often also prevents at least one button from working
# entirely.
#
# This script can be used to discover a software mapping that can be applied by
@gschoppe
gschoppe / cat-like-custom-taxonomy.php
Created February 28, 2016 01:07
Use category (checkbox-based) interface with non-hierarchical custom taxonomies
<?php
// Event taxonomies
add_action( 'init', function() {
$labels = array(
'name' => _x( 'Terms', 'taxonomy general name' ),
'singular_name' => _x( 'Term', 'taxonomy singular name' ),
);
register_taxonomy( 'taxonomy_name', array( 'post' ), array(
'hierarchical' => false,
@tomazzaman
tomazzaman / generateSVG.js
Created January 16, 2016 19:33
Generate PNG from a React-powered SVG. Server-side.
/**
* Run this with `babel-node generateSVG.js`
*/
import fs from 'fs';
import path from 'path';
import { Readable } from 'stream';
import childProcess from 'child_process';
import phantomjs from 'phantomjs';
import im from 'imagemagick';
import tmp from 'tmp';
@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@vicapow
vicapow / README.md
Last active December 17, 2019 11:15
An example of creating a PNG from an SVG in D3.

This is an example of creating a PNG from an SVG. (You should notice that you're able to right click on the last image and save it as a PNG image.) It has been Tested in Firefox and Chrome but doesn't work in Safari as of 2014-07-20.

Normally, you'll create your SVG in D3 but to make the example a bit more readable, the SVG is already placed in the document. There are a few important points. Namely:

  1. All the styles of the SVG need to be self contained in side of the <defs> tags. (These styles should be escaped using the <![[CDATA[ ... ]] tag.)
  2. The SVG needs to have the proper namespaces and document types.
  3. The SVG needs to be saved to an image, then read from an canvas element, then saved to an image again.

Note: Portions of this demo where taken from The New York Times' excellent Crowbar SVG extractor.

@gosukiwi
gosukiwi / .vimrc
Last active February 24, 2020 06:01
.vimrc
" ---------------------- USABILITY CONFIGURATION ----------------------
" Basic and pretty much needed settings to provide a solid base for
" source code editting
" don't make vim compatible with vi
set nocompatible
" turn on syntax highlighting
syntax on
" and show line numbers