Skip to content

Instantly share code, notes, and snippets.

View avillegasn's full-sized avatar

Antonio Villegas avillegasn

View GitHub Profile
@avillegasn
avillegasn / heatmap-hidden.js
Last active March 12, 2023 06:45
Scripts to play with heatmaps in a web
(function(a,b,c){if(typeof module!=="undefined"&&module.exports){module.exports=c()}else if(typeof define==="function"&&define.amd){define(c)}else{b[a]=c()}})("h337",this,function(){var a={defaultRadius:40,defaultRenderer:"canvas2d",defaultGradient:{.25:"rgb(0,0,255)",.55:"rgb(0,255,0)",.85:"yellow",1:"rgb(255,0,0)"},defaultMaxOpacity:1,defaultMinOpacity:0,defaultBlur:.85,defaultXField:"x",defaultYField:"y",defaultValueField:"value",plugins:{}};var b=function h(){var b=function d(a){this._coordinator={};this._data=[];this._radi=[];this._min=0;this._max=1;this._xField=a["xField"]||a.defaultXField;this._yField=a["yField"]||a.defaultYField;this._valueField=a["valueField"]||a.defaultValueField;if(a["radius"]){this._cfgRadius=a["radius"]}};var c=a.defaultRadius;b.prototype={_organiseData:function(a,b){var d=a[this._xField];var e=a[this._yField];var f=this._radi;var g=this._data;var h=this._max;var i=this._min;var j=a[this._valueField]||1;var k=a.radius||this._cfgRadius||c;if(!g[d]){g[d]=[];f[d]=[]}if(!g[d][e]){g[d
<?php
// Register Custom Post Type
function custom_post_type() {
$labels = array(
'name' => _x( 'Recipes', 'Post Type General Name', 'nelio' ),
'singular_name' => _x( 'Recipe', 'Post Type Singular Name', 'nelio' ),
'menu_name' => __( 'Recipes', 'nelio' ),
'name_admin_bar' => __( 'Recipe', 'nelio' ),
<?php
function create_post_type() {
register_post_type( 'recipe',
array(
'labels' => array(
'name' => __( 'Recipes', 'nelio' ),
'singular_name' => __( 'Recipe', 'nelio' )
),
'public' => true,
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
save: function( props ) {
var attributes = props.attributes;
var alignment = props.attributes.alignment;
return (
el( 'div', { className: props.className },
attributes.mediaURL &&
el( 'div', { className: 'nelio-testimonial-image', style: { backgroundImage: 'url('+attributes.mediaURL+')' } },
el( 'img', { src: attributes.mediaURL } ),
),
el( 'div', { className: 'nelio-testimonial-content', style: { textAlign: attributes.alignment } },
edit: function( props ) {
var focus = props.focus;
var focusedEditable = props.focus ? props.focus.editable || 'name' : null;
var alignment = props.attributes.alignment;
var attributes = props.attributes;
var contactURL = props.attributes.contactURL;
var onSelectImage = function( media ) {
return props.setAttributes( {
( function( blocks, components, i18n, element ) {
var el = element.createElement;
blocks.registerBlockType(
// The name of our block. Must be a string with prefix. Example: my-plugin/my-custom-block.
'nelio/testimonial-block', {
// The title of our block.
title: i18n.__( 'Testimonial' ),
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}//end if
/**
* Enqueue the block's assets for the editor.
*
* `wp-blocks`: Includes block type registration and related functions.
@avillegasn
avillegasn / remove-ncshare.sql
Created August 8, 2017 07:27
Remove <ncshare> tags from your WordPress content.
UPDATE wp_posts
SET post_content = REPLACE( REPLACE( post_content, '<ncshare>', '' ), '</ncshare>', '' )
WHERE post_content LIKE '%<ncshare>%'
@avillegasn
avillegasn / custom-admin-logo.php
Last active February 19, 2019 21:21
How to add a custom logo in WordPress login page
function my_login_logo() { ?>
<style type="text/css">
#login h1 a, .login h1 a {
background-image: url(<?php echo get_stylesheet_directory_uri(); ?>/img/nelio-icon.png);
height: 84px;
width: 84px;
background-size: cover;
background-repeat: no-repeat;
}
</style>