Skip to content

Instantly share code, notes, and snippets.

@eridal
eridal / reduce-images.sh
Created November 21, 2018 17:15
useful command-line things
#!/usr/bin/env bash
from=./images
into=./fixed
quality=60 # percent
find $from -type f -name "*.jpg" | while IFS= read -r jpg; do
mkdir -p "$(
dirname "$into"/"$jpg"
)"
@eridal
eridal / scale-circles-generator.html
Last active July 18, 2018 18:09
Scale Circle Generator
<!DOCTYPE html>
<title>Scale Circles Generator</title>
<meta charset=utf-8>
<style>
canvas {
border: 1px solid #eee;
}
</style>
<body>
<canvas width="500" height="500"></canvas>
@eridal
eridal / eclipse.java.code.xml
Created September 9, 2017 00:04
Eclipse Workspace Config
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<profiles version="12">
<profile kind="CodeFormatterProfile" name="Martin" version="12">
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters" value="insert"/>
@eridal
eridal / dp2dot.js
Created July 28, 2017 22:24
Build a dot model from a aws data pipeline json definition
function merge (into, object) {
Object
.keys(object)
.forEach(k => {
let val = object[k]
if (val){
if (Array.isArray(val)) {
into[k] = [].concat(into[k] || [], val)
}
else if (typeof val === 'object') {
@eridal
eridal / adivinar.psc
Created July 2, 2017 14:49
Algoritmos PSeInt
Algoritmo AdivinarMiNumero
Definir secreto Como Entero
Definir adivino Como Entero
secreto <- aleatorio(1, 100)
oportunidades <- 10
Imprimir "Acabo de pensar un numero entre 1 y 100..."
@eridal
eridal / monitorEvents.js
Created November 23, 2016 23:55 — forked from PaulKinlan/monitorEvents.js
monitorEvents.js
function monitorEvents(element) {
var log = function(e) { console.log(e);};
var events = [];
for(var i in element) {
if(i.startsWith("on")) events.push(i.substr(2));
}
events.forEach(function(eventName) {
element.addEventListener(eventName, log);
});
@eridal
eridal / ical-parser.js
Created May 10, 2016 20:45
iCal format parser
'use strict';
function convert(fileData, callback) {
if (typeof fileData !== "string") {
return callback(
new Error("Invalid file data passed.")
);
}
@eridal
eridal / simple.js
Created October 30, 2015 17:11 — forked from paton/simple.js
Super simple implementation of define() and require() used in Localize.js (https://localizejs.com)
var define, require;
(function() {
var modules = {};
require = function(name) {
return modules[name]();
};
define = function(name, fn) {
Do what you can, with what you have, where you are.
- Theodore Roosevelt

Every man dies, but not every man truly lives.
- William Wallace

Life is hard, it's harder if you're stupid.
- John Wayne
<?php
$url = 'http://cdn01.ib.infobae.com/adjuntos/162/rss/Infobae.xml';
$xml = simplexml_load_string(
file_get_contents($url)
);
foreach ($xml->channel->item as $item) {
echo strip_tags($item->title);