Skip to content

Instantly share code, notes, and snippets.

View asterion's full-sized avatar

Marcos Matamala Fernández asterion

View GitHub Profile
@asterion
asterion / functions.php
Created June 15, 2017 20:10
cookie set wordpress
<?php
add_action( 'init', 'set_cookies_banner' );
function set_cookies_banner() {
$banner_id = 1;
if (isset($_GET['banner_id']) && is_numeric($_GET['banner_id'])) {
$banner_id = $_GET['banner_id'];
}
@asterion
asterion / or_category.php
Created June 14, 2017 16:28
or category
$args = array(
'post_type' => 'post',
'tax_query' => array(
'relation' => 'OR',
array(
'taxonomy' => 'category',
'field' => 'slug',
'terms' => array( 'cat1' ),
),
array(
@asterion
asterion / comparacion.c
Created May 30, 2017 14:35
comparacion de código
public class Hola
{
public static void main()
{
System.Console.Writeline("Aca Esto");
}
}
@asterion
asterion / functions.php
Created May 26, 2017 19:03
entero hackers
add_action('admin_head', 'my_hack');
function my_hack() {
echo '<style>.eventBritePluginPlug{ display: none !important; }</style>';
}
@asterion
asterion / seed.rb
Created May 17, 2017 00:34
seed con imagenes
admin = Admin.new
admin.email = 'admin@example.com'
admin.password = 'xxxxxxx'
admin.password_confirmation = 'xxxxxxx'
admin.image = File.new(open("#{Rails.root}/public/images/pic33.jpg"))
admin.save
<?php
$themes = array('wp-theme','wp-theme-2', 'wp-theme-3', 'font-awesome', 'icons', 'media-wp');
$themesFilter = array_filter($themes, function($theme){
return preg_match('/^wp/', $theme);
});
print_r($themesFilter);
var foo = JSON.parse('[{"Deal Name": "tenic", "Stage": "Invoice", "Income": 104000, "Currency": "US Dollar", "Responsible": "icorp2404@gmail.com", "Type": "Service B", "Created": "04/24/2017 05:22:28 pm", "Product": "", "Price": "", "Quantity": "", "ID": 9862, "Pipeline": "General", "":""}, {"Deal Name": "neojo", "Stage": "Create papers", "Income": 3000000, "Currency": "US Dollar", "Responsible": "icorp2404@gmail.com", "Type": "Service A", "Created": "04/24/2017 05:22:28 pm", "Product": "", "Price": "", "Quantity": "", "ID": 9864, "Pipeline": "General" }]');
var data = [
{type: "a", income: 1},
{type: "a", income: 1},
{type: "e", income: 1},
{type: "c", income: 1},
{type: "d", income: 1},
{type: "d", income: 1},
{type: "d", income: 1},
];
@asterion
asterion / index.html
Created April 27, 2017 21:10
HTML+js+css
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Tabla</title>
<style media="screen">
.color0{ background-color: #ddd; }
.color1{ background-color: teal; }
.color2{ background-color: green; }
.color3{ background-color: gold; }
@asterion
asterion / javascript
Created April 27, 2017 20:24
javascript + css + json
var colors = {x: y};
for (h=0;h<24;h++){
i=h*2;
val1 = eval("json."+(root+i));//concat strings and values to access h vars
val2 = eval("json."+(root+(i+1)));
if (val1 != null && val2 != null){
table.append("<tr style=\"background-color:"+ colors[x] +"\"><td>"+formattedH(h)+":00 </td> <td id="+i+">"+val1+"</td><td id="+(i+1)+">"+val2+"</td></tr>");
}
}