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 / left
Created February 12, 2015 15:23
SQL JOIN
SELECT foo.* FROM foo, bar WHERE foo.id = bar.foo_id
@asterion
asterion / pagos.sql
Created January 23, 2017 12:54
Modelo_de_datos_Cliente_Pagos
CREATE TABLE cliente (
`id` int(11) NOT NULL,
`name` varchar(128) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
INSERT INTO cliente VALUES(1, 'Coca-Cola');
INSERT INTO cliente VALUES(3, 'IBM');
INSERT INTO cliente VALUES(4, 'Logitech');
INSERT INTO cliente VALUES(2, 'Toyota');
@asterion
asterion / persona.rb
Last active March 20, 2017 11:15
persona
persona = {
nombre: "kyary",
edad: 24,
twitter: "twitter.pamyurin"
}
puts "desea añadir una clave y valor al hash? : "
resp = gets.chomp
if resp == "si"
puts "cual es el nombre de la nueva clave?? : "
resp_clave = gets.chomp.to_sym
@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>");
}
}
@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; }
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},
];
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" }]');
<?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);
@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
@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>';
}