<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Ako&#039;s warehouse</title>
	<atom:link href="http://blog.jonaszamora.es/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.jonaszamora.es</link>
	<description></description>
	<lastBuildDate>Tue, 01 Jul 2014 16:18:30 +0000</lastBuildDate>
	<language>es-ES</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=247</generator>
	<item>
		<title>Holy Water &#8211; Censura en las stores</title>
		<link>http://blog.jonaszamora.es/holy-water-censura-en-las-stores/</link>
		<comments>http://blog.jonaszamora.es/holy-water-censura-en-las-stores/#comments</comments>
		<pubDate>Tue, 17 Jun 2014 15:35:54 +0000</pubDate>
		<dc:creator><![CDATA[Jonas Zamora]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.jonaszamora.es/?p=489</guid>
		<description><![CDATA[<p>Después de haberme peleado sin éxito contra la absurda censura de Itunes Connect y Google Play con tal de publicar Fap Fapp he acabado desarrollando la misma versión para beatos, Holy Water. Itunes Connect rechazó Fap Fapp varias veces por &#8230; <a href="http://blog.jonaszamora.es/holy-water-censura-en-las-stores/">Seguir leyendo <span class="meta-nav">></span></a></p>
<p>La entrada <a rel="nofollow" href="http://blog.jonaszamora.es/holy-water-censura-en-las-stores/">Holy Water &#8211; Censura en las stores</a> aparece primero en <a rel="nofollow" href="http://blog.jonaszamora.es">Ako&#039;s warehouse</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>Después de haberme peleado sin éxito contra la absurda censura de Itunes Connect y Google Play con tal de publicar <a href="http://fapfapp.com" target="_blank">Fap Fapp</a> he acabado desarrollando la misma versión para beatos, <a href="http://fapfapp.com/holywater" target="_blank">Holy Water</a>.</p>
<p><a target="_blank" href="http://fapfapp.com/holywater"><img src="http://blog.jonaszamora.es/wp-content/uploads/2014/06/Captura-de-pantalla-2014-06-17-a-las-17.27.02.png" alt="" title="Captura de pantalla 2014-06-17 a la(s) 17.27.02" width="1320" height="368" class="aligncenter size-full wp-image-493" /></a></p>
<p>Itunes Connect rechazó Fap Fapp varias veces por el motivo de ser simple y no corresponder a los estándares de calidad de Apple:</p>
<p><img src="http://blog.jonaszamora.es/wp-content/uploads/2014/06/3.jpg" alt="" title="3" width="808" height="414" class="aligncenter size-full wp-image-491" /><br />
Lejos de darse por vencido, mejoré la aplicación para pasar cada uno de los rechazos. Al final, después de varios meses, la negación llegó , ya que según los revisores, la aplicación mostraba sexo explícito (sin comentarios&#8230;). Era un no tajante.</p>
<p>En cuanto a Google Play, desde el primer momento aseguraron que mostrábamos sexo de manera explícita. De todas formas se puede descargar la aplicación desde la web <a href="http:fapfapp.com" target="_blank">fapfapp.com</a> a través del link superior de ésta. Cada cual que juzgue la ingente cantidad de sexo mostrada.</p>
<p>Para no tirar el trabajo realizado, se intentó una vez más. Cambio de gráfica y tema. Misma aplicación, pero en lugar de masturbarse, se trataba de bendecir a los paganos. Pasó en ambas stores sin problemas. Impresionante la hipocresía demostrada.</p>
<p>La entrada <a rel="nofollow" href="http://blog.jonaszamora.es/holy-water-censura-en-las-stores/">Holy Water &#8211; Censura en las stores</a> aparece primero en <a rel="nofollow" href="http://blog.jonaszamora.es">Ako&#039;s warehouse</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jonaszamora.es/holy-water-censura-en-las-stores/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fap Fapp aplicación que mide la agitación del móvil</title>
		<link>http://blog.jonaszamora.es/fap-fapp-aplicacion-que-mide-la-agitacion-del-movil/</link>
		<comments>http://blog.jonaszamora.es/fap-fapp-aplicacion-que-mide-la-agitacion-del-movil/#comments</comments>
		<pubDate>Wed, 23 Apr 2014 18:23:12 +0000</pubDate>
		<dc:creator><![CDATA[Jonas Zamora]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[apps]]></category>

		<guid isPermaLink="false">http://blog.jonaszamora.es/?p=464</guid>
		<description><![CDATA[<p>Link: Link Google Play Update: Google Play ha cancelado la aplicación. Diseño : Francesc Moret Web: http://fapfapp.com Fap Fapp es una aplicación que calcula las sacudidas que se le da a móvil y obtiene una puntuación para poder participar en &#8230; <a href="http://blog.jonaszamora.es/fap-fapp-aplicacion-que-mide-la-agitacion-del-movil/">Seguir leyendo <span class="meta-nav">></span></a></p>
<p>La entrada <a rel="nofollow" href="http://blog.jonaszamora.es/fap-fapp-aplicacion-que-mide-la-agitacion-del-movil/">Fap Fapp aplicación que mide la agitación del móvil</a> aparece primero en <a rel="nofollow" href="http://blog.jonaszamora.es">Ako&#039;s warehouse</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p><del datetime="2014-04-24T08:18:18+00:00">Link: <a href="https://play.google.com/store/apps/details?id=com.fapfapp.free" target="_blank">Link Google Play</a></del> Update: Google Play ha cancelado la aplicación.<br />
Diseño : <a href="http://francescmoret.com" target="_blank">Francesc Moret</a><br />
Web: <a href="http://fapfapp.com" target="_blank">http://fapfapp.com</a></p>
<p><a href="https://play.google.com/store/apps/details?id=com.fapfapp.free" target="_blank"><img width="100%" src="http://blog.jonaszamora.es/wp-content/uploads/2014/04/10295286_789148637769671_3042630981287125849_o.png"></a><br />
<br/><br />
Fap Fapp es una aplicación que calcula las sacudidas que se le da a móvil y obtiene una puntuación para poder participar en un ranking. Los gráficos son sencillos y minimal, en parte para pasar la censura de los revisores de Apple o Google. No olvidemos que, al fin y al cabo, es una referencia a la masturbación. (FAP FAP es el meme o más bien dicho la onomatopeya internacional para tal acto impío).</p>
<p>En un principio, pensamos y diseñamos Fap Fapp para iPhone. Sin embargo, Apple tiene unas políticas bastante estrictas a la hora de publicar aplicaciones. Así que tras intentarlo durante varias revisiones sin éxito, en lugar de desechar la aplicación, cambiamos a Google Play.</p>
<p>Para minimizar el tiempo de desarrollo en Android, la aplicación se ha implementado usando <strong>jQuery Mobile</strong> y <strong>PhoneGap</strong>.</p>
<p>La entrada <a rel="nofollow" href="http://blog.jonaszamora.es/fap-fapp-aplicacion-que-mide-la-agitacion-del-movil/">Fap Fapp aplicación que mide la agitación del móvil</a> aparece primero en <a rel="nofollow" href="http://blog.jonaszamora.es">Ako&#039;s warehouse</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jonaszamora.es/fap-fapp-aplicacion-que-mide-la-agitacion-del-movil/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reducir una imagen antes de subirla via Canvas</title>
		<link>http://blog.jonaszamora.es/reducir-una-imagen-antes-de-subirla-via-canvas/</link>
		<comments>http://blog.jonaszamora.es/reducir-una-imagen-antes-de-subirla-via-canvas/#comments</comments>
		<pubDate>Mon, 23 Sep 2013 07:00:31 +0000</pubDate>
		<dc:creator><![CDATA[Jonas Zamora]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[programación web]]></category>

		<guid isPermaLink="false">http://blog.jonaszamora.es/?p=439</guid>
		<description><![CDATA[<p>Normalmente a la hora de subir una imagen a un servidor o hosting mediante un formulario se utilizan los input de tipo file. ¿Qué sucede si la imagen que queremos subir no debe superar un cierto tamaño? En la mayoría &#8230; <a href="http://blog.jonaszamora.es/reducir-una-imagen-antes-de-subirla-via-canvas/">Seguir leyendo <span class="meta-nav">></span></a></p>
<p>La entrada <a rel="nofollow" href="http://blog.jonaszamora.es/reducir-una-imagen-antes-de-subirla-via-canvas/">Reducir una imagen antes de subirla via Canvas</a> aparece primero en <a rel="nofollow" href="http://blog.jonaszamora.es">Ako&#039;s warehouse</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>Normalmente a la hora de subir una imagen a un servidor o hosting mediante un formulario se utilizan los <em>input </em>de tipo <em>file</em>.<br />
¿Qué sucede si la imagen que queremos subir no debe superar un cierto tamaño?</p>
<p>En la mayoría de casos lo que se hace es enviar esa imagen a través del input y una vez se ha cargado en el servidor, éste comprueba si tiene un tamaño aceptado y si no lo tiene aborta el proceso y la destruye. Cuantas veces no habéis visto el típico &#8220;Subiendo&#8221; en la barra del navegador y una vez acaba dice algo como &#8220;Archivo demasiado grande&#8221;.</p>
<p>Con <em>Canvas</em> podemos reducir la imagen con el fin de reducir el tamaño antes de subirla. Obviamente perderemos calidad, pero nos ahorrará poner un mensaje diciendo que no se admiten imágenes > 1 MB y que luego nos contacten usuarios, que no se molestan en leer, diciendo que intentan subir un TIFF de 50MB y les peta la web (/sight).</p>
<p>La idea es fijar un tamaño fijo de píxeles para el ancho (<em>Nx</em>) y el alto (<em>Ny</em>) de la imagen y que al reducirla esta no pueda sobrepasar nunca esos tamaños. Es más, para asegurarnos, podríamos hacer que <em>Nx</em> y <em>Ny</em> fueran iguales y definir <em>N = Nx = Ny</em>. Esto aseguraría que cualquier imagen que tuviera longitud y altura por debajo de N, ocuparía siempre menos que su imagen de número de píxeles NxN.</p>
<p>Y si por lo que fuera las imágenes tuvieran que ocupar un tamaño considerable siempre se puede prescindir de la subida por defecto por <em>input file</em> y utilizar objetos <strong>Blob</strong> de <em>Canvas</em> para controlar la transferencia de subida.</p>
<p>Suponiendo que tenemos una input file que utilizamos para coger las imágenes:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="html" style="font-family:monospace;">&lt;input id=&quot;fbBrowseBtn&quot; type=&quot;file&quot; name=&quot;photo[]&quot; multiple&gt;</pre></td></tr></table></div>

<p>Con el siguiente código de Javascript podríamos cojer la imagen, reducirla, enviarla y controlar el progreso una vez haya finalizado la acción:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">var</span> files <span style="color: #339933;">=</span> document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'fbBrowseBtn'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">files</span><span style="color: #339933;">;</span>
resizeAndUpload<span style="color: #009900;">&#40;</span>files<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> uploaded<span style="color: #339933;">,</span> progressBar<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">function</span> resizeAndUpload<span style="color: #009900;">&#40;</span>file<span style="color: #339933;">,</span> callback<span style="color: #339933;">,</span> progress<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000066; font-weight: bold;">var</span> reader <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">new</span> FileReader<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	reader.<span style="color: #660066;">onloadend</span> <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">var</span> tempImg <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">new</span> Image<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		tempImg.<span style="color: #660066;">onload</span> <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #006600; font-style: italic;">// Comprobamos con el aspect cómo será la reducción</span>
			<span style="color: #006600; font-style: italic;">// MAX_IMAGE_SIZE_PROCESS es la N que definimos como máxima</span>
			<span style="color: #000066; font-weight: bold;">var</span> MAX_WIDTH <span style="color: #339933;">=</span> MAX_IMAGE_SIZE_PROCESS<span style="color: #339933;">;</span>
			<span style="color: #000066; font-weight: bold;">var</span> MAX_HEIGHT <span style="color: #339933;">=</span> MAX_IMAGE_SIZE_PROCESS<span style="color: #339933;">;</span>
			<span style="color: #000066; font-weight: bold;">var</span> tempW <span style="color: #339933;">=</span> tempImg.<span style="color: #660066;">width</span><span style="color: #339933;">;</span>
			<span style="color: #000066; font-weight: bold;">var</span> tempH <span style="color: #339933;">=</span> tempImg.<span style="color: #660066;">height</span><span style="color: #339933;">;</span>
			<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>tempW <span style="color: #339933;">&gt;</span> tempH<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>tempW <span style="color: #339933;">&gt;</span> MAX_WIDTH<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
					tempH <span style="color: #339933;">*=</span> MAX_WIDTH <span style="color: #339933;">/</span> tempW<span style="color: #339933;">;</span>
					tempW <span style="color: #339933;">=</span> MAX_WIDTH<span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span>
			<span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>tempH <span style="color: #339933;">&gt;</span> MAX_HEIGHT<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
					tempW <span style="color: #339933;">*=</span> MAX_HEIGHT <span style="color: #339933;">/</span> tempH<span style="color: #339933;">;</span>
					tempH <span style="color: #339933;">=</span> MAX_HEIGHT<span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span>
			<span style="color: #009900;">&#125;</span>
			<span style="color: #006600; font-style: italic;">// Creamos un canvas para la imagen reducida y la dibujamos</span>
			<span style="color: #000066; font-weight: bold;">var</span> resizedCanvas <span style="color: #339933;">=</span> document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'canvas'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			resizedCanvas.<span style="color: #660066;">width</span> <span style="color: #339933;">=</span> tempW<span style="color: #339933;">;</span>
			resizedCanvas.<span style="color: #660066;">height</span> <span style="color: #339933;">=</span> tempH<span style="color: #339933;">;</span>
			<span style="color: #000066; font-weight: bold;">var</span> ctx <span style="color: #339933;">=</span> resizedCanvas.<span style="color: #660066;">getContext</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;2d&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			ctx.<span style="color: #660066;">drawImage</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> tempW<span style="color: #339933;">,</span> tempH<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000066; font-weight: bold;">var</span> dataURL <span style="color: #339933;">=</span> resizedCanvas.<span style="color: #660066;">toDataURL</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;image/jpeg&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #006600; font-style: italic;">// Pasamos la dataURL que nos devuelve Canvas a objeto Blob</span>
			<span style="color: #006600; font-style: italic;">// Envíamos por Ajax el objeto Blob</span>
			<span style="color: #006600; font-style: italic;">// Cogiendo el valor de photo (nombre del input file)</span>
			<span style="color: #000066; font-weight: bold;">var</span> file <span style="color: #339933;">=</span> dataURLtoBlob<span style="color: #009900;">&#40;</span>dataURL<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000066; font-weight: bold;">var</span> fd <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">new</span> FormData<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			fd.<span style="color: #660066;">append</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;photo&quot;</span><span style="color: #339933;">,</span> file<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			$.<span style="color: #660066;">ajax</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
				url<span style="color: #339933;">:</span> <span style="color: #339933;">&lt;&lt;</span>url del endpoint que se encarga de la subida<span style="color: #339933;">&gt;&gt;,</span>
				type<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;POST&quot;</span><span style="color: #339933;">,</span>
				data<span style="color: #339933;">:</span> fd<span style="color: #339933;">,</span>
				processData<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">,</span>
				contentType<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">,</span>
				dataType<span style="color: #339933;">:</span> <span style="color: #3366CC;">'json'</span><span style="color: #339933;">,</span>
				xhr<span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
					<span style="color: #000066; font-weight: bold;">var</span> xhr <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">new</span> window.<span style="color: #660066;">XMLHttpRequest</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					xhr.<span style="color: #660066;">upload</span>.<span style="color: #660066;">addEventListener</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;progress&quot;</span><span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>evt<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
						<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>evt.<span style="color: #660066;">lengthComputable</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
							<span style="color: #006600; font-style: italic;">// Calculando el porcentaje de todo el proceso </span>
							<span style="color: #000066; font-weight: bold;">var</span> percentComplete <span style="color: #339933;">=</span> evt.<span style="color: #660066;">loaded</span> <span style="color: #339933;">/</span> evt.<span style="color: #660066;">total</span><span style="color: #339933;">;</span>
							progress<span style="color: #009900;">&#40;</span>percentComplete <span style="color: #339933;">*</span> PERCENT_UPLOAD <span style="color: #339933;">*</span> <span style="color: #CC0000;">0.01</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
						<span style="color: #009900;">&#125;</span>
					<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					<span style="color: #000066; font-weight: bold;">return</span> xhr<span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span>
			<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">done</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>respond<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #006600; font-style: italic;">// Una vez ha acabado la subida</span>
				callback<span style="color: #009900;">&#40;</span>respond<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
		tempImg.<span style="color: #660066;">src</span> <span style="color: #339933;">=</span> reader.<span style="color: #660066;">result</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	reader.<span style="color: #660066;">readAsDataURL</span><span style="color: #009900;">&#40;</span>file<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">function</span> dataURLtoBlob<span style="color: #009900;">&#40;</span>dataURL<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #006600; font-style: italic;">// Decodifica dataURL</span>
	<span style="color: #000066; font-weight: bold;">var</span> binary <span style="color: #339933;">=</span> atob<span style="color: #009900;">&#40;</span>dataURL.<span style="color: #660066;">split</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">','</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #006600; font-style: italic;">// Se transfiere a un array de 8-bit unsigned</span>
	<span style="color: #000066; font-weight: bold;">var</span> array <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">var</span> length <span style="color: #339933;">=</span> binary.<span style="color: #660066;">length</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">var</span> i <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> length<span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		array.<span style="color: #660066;">push</span><span style="color: #009900;">&#40;</span>binary.<span style="color: #660066;">charCodeAt</span><span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #006600; font-style: italic;">// Retorna el objeto Blob</span>
	<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">new</span> Blob<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#91;</span><span style="color: #000066; font-weight: bold;">new</span> Uint8Array<span style="color: #009900;">&#40;</span>array<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>type<span style="color: #339933;">:</span> <span style="color: #3366CC;">'image/jpeg'</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">function</span> uploaded<span style="color: #009900;">&#40;</span>response<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #006600; font-style: italic;">// Código siguiente a la subida</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">function</span> progressBar<span style="color: #009900;">&#40;</span>percent<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #006600; font-style: italic;">// Código durante la subida</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>El método controlador del endpoint sería algo así:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'success'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// Miramos que efectivamente sea un imagen</span>
<span style="color: #000088;">$size</span> <span style="color: #339933;">=</span> <span style="color: #990000;">getimagesize</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_FILES</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'photo'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'tmp_name'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$size</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>	<span style="color: #009900;">&#40;</span>
		<span style="color: #000088;">$_FILES</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'photo'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'type'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'image/gif'</span> <span style="color: #339933;">||</span> 
		<span style="color: #000088;">$_FILES</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'photo'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'type'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'image/jpeg'</span> <span style="color: #339933;">||</span> 
		<span style="color: #000088;">$_FILES</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'photo'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'type'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'image/jpg'</span> <span style="color: #339933;">||</span> 
		<span style="color: #000088;">$_FILES</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'photo'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'type'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'image/pjpeg'</span> <span style="color: #339933;">||</span> 
		<span style="color: #000088;">$_FILES</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'photo'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'type'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'image/png'</span> <span style="color: #339933;">||</span> 
		<span style="color: #000088;">$_FILES</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'photo'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'type'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'image/x-png'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #666666; font-style: italic;">// Es una imagen, la guardamos cogiendo los datos de la key 'photo' de $_FILES</span>
			<span style="color: #000088;">$newFile</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;path definitiva donde se guardará la imagen&quot;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">move_uploaded_file</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_FILES</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'photo'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'tmp_name'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$newFile</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #666666; font-style: italic;">// Todo ha ido bien, devolvemos la ubicación de la imagen.</span>
				<span style="color: #666666; font-style: italic;">// Marcamos la respuesta como buena</span>
				<span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'success'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
				<span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'image'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$newFile</span><span style="color: #339933;">;</span>
				<span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'msg'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> lang<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'upload_success'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #666666; font-style: italic;">// Error transfiriendo la imagen a la ubicación</span>
				<span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'msg'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> lang<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'upload_error'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// No se trata de una imagen habitual</span>
		<span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'msg'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> lang<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'upload_error_extension'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #666666; font-style: italic;">// No es una imagen</span>
	<span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'msg'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> lang<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'upload_error_noimage'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">echo</span> json_endode<span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Ambos casos tuve que aplicarlos en una nueva página que hice por mera diversión: <a href="http://letspixel.es" title="Let's Pixel" target="_blank">Let&#8217;s Pixel</a>.</p>
<p>La entrada <a rel="nofollow" href="http://blog.jonaszamora.es/reducir-una-imagen-antes-de-subirla-via-canvas/">Reducir una imagen antes de subirla via Canvas</a> aparece primero en <a rel="nofollow" href="http://blog.jonaszamora.es">Ako&#039;s warehouse</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jonaszamora.es/reducir-una-imagen-antes-de-subirla-via-canvas/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Twitter: Error leyendo tweets sin autentificar con la API 1.0</title>
		<link>http://blog.jonaszamora.es/twitter-error-tweets-sin-autentificar-con-la-api-1-0/</link>
		<comments>http://blog.jonaszamora.es/twitter-error-tweets-sin-autentificar-con-la-api-1-0/#comments</comments>
		<pubDate>Fri, 21 Jun 2013 15:27:35 +0000</pubDate>
		<dc:creator><![CDATA[Jonas Zamora]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[programación web]]></category>

		<guid isPermaLink="false">http://blog.jonaszamora.es/?p=402</guid>
		<description><![CDATA[<p>Twitter ha actualizado su API a la versión 1.1. Uno de los cambios de esta API ha provocado que muchas de las páginas en las que había programado una lista de tweets para una cuenta de Twitter determinada dejaran de &#8230; <a href="http://blog.jonaszamora.es/twitter-error-tweets-sin-autentificar-con-la-api-1-0/">Seguir leyendo <span class="meta-nav">></span></a></p>
<p>La entrada <a rel="nofollow" href="http://blog.jonaszamora.es/twitter-error-tweets-sin-autentificar-con-la-api-1-0/">Twitter: Error leyendo tweets sin autentificar con la API 1.0</a> aparece primero en <a rel="nofollow" href="http://blog.jonaszamora.es">Ako&#039;s warehouse</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>Twitter ha actualizado su API a la versión <a href="https://dev.twitter.com/docs/api/1.1/overview" title="Twitter API 1.1" target="_blank">1.1</a>.</p>
<p>Uno de los cambios de esta API ha provocado que muchas de las páginas en las que había programado una lista de tweets para una cuenta de Twitter determinada dejaran de funcionar.<br />
Por ejemplo en muchos casos programé bloques o muros de tweets utilizando <a href="http://tweet.seaofclouds.com/" title="Plugin jQuery para cargar tweets" target="_blank">Tweet!</a> (plugin de jQuery).</p>
<p>La conexión que realiza este plugin, a día de hoy, se basa en la vieja API 1.0 en la que no eran necesarias las conexiones autentificadas. No me ha quedado otra que revisar página a página y adaptar el listado de tweets a la nueva API 1.1.</p>
<p>Por suerte, mucha gente se ha encontrado en el mismo problema y ya han encontrado una solución que permite no empezar desde 0.</p>
<p>En <a href="https://github.com/StanScates/Tweet.js-Mod" title="Modificación Tweet! para la nueva API 1.1" target="_blank">este repositorio</a> de GitHub se pueden descargar los nuevos archivos php y js necesarios para que vuelva a funcionar.</p>
<p>Los pasos a seguir son los siguientes:</p>
<p><strong>1)</strong> El repositorio utiliza como acceso a la API la dirección /twitter. En mi caso, como la mayoría de mis webs funcionan con CI, he tenido que crear un controlador llamado twitter en cada una de ellas.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span> <span style="color: #990000;">defined</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'BASEPATH'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #990000;">exit</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'No direct script access allowed'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> Twitter <span style="color: #000000; font-weight: bold;">extends</span> CI_Controller <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> index<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">twitteroauth</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">init</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">twitteroauth</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">fetch</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p><strong>2)</strong> Sobrescribir el fichero de Tweet! jquery.tweet.js o su minificado, depende de cual hayamos utilizado.</p>
<p><strong>3)</strong> Crear una app en Twitter. Entramos en <a href="https://dev.twitter.com/apps" title="Twitter developers" target="_blank">https://dev.twitter.com/apps</a> y creamos una aplicación rellenando el formulario, indicando como <em>Callback URL</em> y <em>Website</em> la dirección de nuestra página web. Una vez creada generará unos campos que son los que utilizaremos en las variables de configuración de la clase <em>ezTweet</em> si estáis siguiendo los archivos del repositorio. Los campos son <em>App Consume Key, App Consumer Secret, App Access Token y App Access Token Secret</em>.</p>
<p><img src="http://blog.jonaszamora.es/wp-content/uploads/2014/06/twitter.jpg" alt="" title="twitter" width="1004" height="563" class="aligncenter size-full wp-image-410" /></p>
<p><strong>4)</strong> Adaptar las librerías PHP y el archivo index.php para realizar la autentificación. De nuevo, en el caso de CI, hay que adaptarlo. Lo que he ido haciendo es crear librerías con el código que viene en index.php adaptado y las llamo desde el controlador de twitter. Es decir, me he cargado la clase ezTweet y he creado una nueva TwitterOauth que lo único diferente que tiene es que inicializa sus variables de configuración en una función <em>init</em>:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span> <span style="color: #990000;">defined</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'BASEPATH'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #990000;">exit</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'No direct script access allowed'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009933; font-style: italic;">/**
 * Current TwitterOauth Class
 *
 * @package	Twitter oAuth
 * @subpackage	Libraries
 * @category	Utils Functions
 */</span>
<span style="color: #000000; font-weight: bold;">class</span> CI_TwitterOauth <span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Your Twitter App Consumer Key</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$consumer_key</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Your Twitter App Consumer Secret</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$consumer_secret</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Your Twitter App Access Token</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$user_token</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Your Twitter App Access Token Secret</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$user_secret</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Path to tmhOAuth libraries</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$lib</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Enable caching</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$cache_enabled</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Cache interval (minutes)</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$cache_interval</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">15</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Path to writable cache directory</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$cache_dir</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'./'</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Enable debugging</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$debug</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">/**************************************************************************************/</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> init<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">CI</span> <span style="color: #339933;">=&amp;</span> get_instance<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Initialize paths and etc.</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">pathify</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">cache_dir</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">pathify</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">lib</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">message</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Set server-side debug params</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">debug</span> <span style="color: #339933;">===</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #990000;">error_reporting</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #990000;">error_reporting</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">consumer_key</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'CONSUMER KEY AQUÍ'</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">consumer_secret</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'CONSUMER SECRET AQUÍ'</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">user_token</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'USER TOKEN AQUÍ'</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">user_secret</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'USER SECRET AQUÍ'</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">lib</span> <span style="color: #339933;">=</span> APPPATH<span style="color: #339933;">.</span> <span style="color: #0000ff;">'libraries/lib/'</span><span style="color: #339933;">;</span>   <span style="color: #666666; font-style: italic;">// En mi caso tengo los archivos tmhOAuth.php y tmhUtilities.php del repositorio en application/libraries/lib</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">cache_enabled</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">cache_interval</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">15</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">cache_dir</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'./'</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">debug</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> fetch<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #990000;">json_encode</span><span style="color: #009900;">&#40;</span>
			<span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
				<span style="color: #0000ff;">'response'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">json_decode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getJSON</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
				<span style="color: #0000ff;">'message'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">debug</span><span style="color: #009900;">&#41;</span> ? <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">message</span> <span style="color: #339933;">:</span> <span style="color: #009900; font-weight: bold;">false</span>
			<span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">function</span> getJSON<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">cache_enabled</span> <span style="color: #339933;">===</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$CFID</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">generateCFID</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$cache_file</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">cache_dir</span><span style="color: #339933;">.</span><span style="color: #000088;">$CFID</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">file_exists</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cache_file</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">filemtime</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cache_file</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">time</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> <span style="color: #cc66cc;">60</span> <span style="color: #339933;">*</span> <span style="color: #990000;">intval</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">cache_interval</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #b1b100;">return</span> <span style="color: #990000;">file_get_contents</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cache_file</span><span style="color: #339933;">,</span> FILE_USE_INCLUDE_PATH<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
&nbsp;
				<span style="color: #000088;">$JSONraw</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getTwitterJSON</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #000088;">$JSON</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$JSONraw</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'response'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
				<span style="color: #666666; font-style: italic;">// Don't write a bad cache file if there was a CURL error</span>
				<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$JSONraw</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'errno'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">!=</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
					<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">consoleDebug</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$JSONraw</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'error'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					<span style="color: #b1b100;">return</span> <span style="color: #000088;">$JSON</span><span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span>
&nbsp;
				<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">debug</span> <span style="color: #339933;">===</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
					<span style="color: #666666; font-style: italic;">// Check for twitter-side errors</span>
					<span style="color: #000088;">$pj</span> <span style="color: #339933;">=</span> <span style="color: #990000;">json_decode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$JSON</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$pj</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'errors'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
						<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$pj</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'errors'</span><span style="color: #009900;">&#93;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$error</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
							<span style="color: #000088;">$message</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'Twitter Error: &quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$error</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'message'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;, Error Code #'</span><span style="color: #339933;">.</span><span style="color: #000088;">$error</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'code'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
							<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">consoleDebug</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$message</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
						<span style="color: #009900;">&#125;</span>
						<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
					<span style="color: #009900;">&#125;</span>
				<span style="color: #009900;">&#125;</span>
&nbsp;
				<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">is_writable</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">cache_dir</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$JSONraw</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
					<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">file_put_contents</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cache_file</span><span style="color: #339933;">,</span> <span style="color: #000088;">$JSON</span><span style="color: #339933;">,</span> LOCK_EX<span style="color: #009900;">&#41;</span> <span style="color: #339933;">===</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
						<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">consoleDebug</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Error writing cache file&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					<span style="color: #009900;">&#125;</span>
				<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
					<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">consoleDebug</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Cache directory is not writable&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span>
				<span style="color: #b1b100;">return</span> <span style="color: #000088;">$JSON</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$JSONraw</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getTwitterJSON</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">debug</span> <span style="color: #339933;">===</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #666666; font-style: italic;">// Check for CURL errors</span>
				<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$JSONraw</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'errno'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">!=</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
					<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">consoleDebug</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$JSONraw</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'error'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span>
&nbsp;
				<span style="color: #666666; font-style: italic;">// Check for twitter-side errors</span>
				<span style="color: #000088;">$pj</span> <span style="color: #339933;">=</span> <span style="color: #990000;">json_decode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$JSONraw</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'response'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$pj</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'errors'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
					<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$pj</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'errors'</span><span style="color: #009900;">&#93;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$error</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
						<span style="color: #000088;">$message</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'Twitter Error: &quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$error</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'message'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;, Error Code #'</span><span style="color: #339933;">.</span><span style="color: #000088;">$error</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'code'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
						<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">consoleDebug</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$message</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					<span style="color: #009900;">&#125;</span>
					<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span>
			<span style="color: #009900;">&#125;</span>
			<span style="color: #b1b100;">return</span> <span style="color: #000088;">$JSONraw</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'response'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">function</span> getTwitterJSON<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">require</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">lib</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'tmhOAuth.php'</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">require</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">lib</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'tmhUtilities.php'</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000088;">$tmhOAuth</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> tmhOAuth<span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
			<span style="color: #0000ff;">'host'</span>                  <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'request'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'host'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'consumer_key'</span>          <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">consumer_key</span><span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'consumer_secret'</span>       <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">consumer_secret</span><span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'user_token'</span>            <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">user_token</span><span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'user_secret'</span>           <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">user_secret</span><span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'curl_ssl_verifypeer'</span>   <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">false</span>
		<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000088;">$url</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'request'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'url'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$params</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'request'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'parameters'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000088;">$tmhOAuth</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">request</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'GET'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$tmhOAuth</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">url</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$params</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #000088;">$tmhOAuth</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">response</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">function</span> generateCFID<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// The unique cached filename ID</span>
		<span style="color: #b1b100;">return</span> <span style="color: #990000;">md5</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">serialize</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'.json'</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">function</span> pathify<span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span><span style="color: #000088;">$path</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// Ensures our user-specified paths are up to snuff</span>
		<span style="color: #000088;">$path</span> <span style="color: #339933;">=</span> <span style="color: #990000;">realpath</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$path</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'/'</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">function</span> consoleDebug<span style="color: #009900;">&#40;</span><span style="color: #000088;">$message</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">debug</span> <span style="color: #339933;">===</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">message</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'tweet.js: '</span><span style="color: #339933;">.</span><span style="color: #000088;">$message</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>La entrada <a rel="nofollow" href="http://blog.jonaszamora.es/twitter-error-tweets-sin-autentificar-con-la-api-1-0/">Twitter: Error leyendo tweets sin autentificar con la API 1.0</a> aparece primero en <a rel="nofollow" href="http://blog.jonaszamora.es">Ako&#039;s warehouse</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jonaszamora.es/twitter-error-tweets-sin-autentificar-con-la-api-1-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Consejos a la hora de montar tu propia web o tienda virtual</title>
		<link>http://blog.jonaszamora.es/consejos-a-la-hora-de-montar-tu-propia-web-o-tienda-virtual/</link>
		<comments>http://blog.jonaszamora.es/consejos-a-la-hora-de-montar-tu-propia-web-o-tienda-virtual/#comments</comments>
		<pubDate>Wed, 19 Jun 2013 11:04:41 +0000</pubDate>
		<dc:creator><![CDATA[Jonas Zamora]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[miscelánea]]></category>

		<guid isPermaLink="false">http://blog.jonaszamora.es/?p=359</guid>
		<description><![CDATA[<p>Este post es el resultado de multitud de experiencias como programador que he tenido a la hora de programar y diseñar ya sean webs corporativas, aplicaciones webs o tiendas virtuales. Me he cruzado con todo tipo de clientes y puedo &#8230; <a href="http://blog.jonaszamora.es/consejos-a-la-hora-de-montar-tu-propia-web-o-tienda-virtual/">Seguir leyendo <span class="meta-nav">></span></a></p>
<p>La entrada <a rel="nofollow" href="http://blog.jonaszamora.es/consejos-a-la-hora-de-montar-tu-propia-web-o-tienda-virtual/">Consejos a la hora de montar tu propia web o tienda virtual</a> aparece primero en <a rel="nofollow" href="http://blog.jonaszamora.es">Ako&#039;s warehouse</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>Este post es el resultado de multitud de experiencias como programador que he tenido a la hora de programar y diseñar ya sean webs corporativas, aplicaciones webs o tiendas virtuales.</p>
<p>Me he cruzado con todo tipo de clientes y puedo afirmar que existen unas normas básicas que cuando son incumplidas por alguna de las partes (cliente &#8211; diseñador / programador) surgen problemas que o bien merman la calidad o bien incrementan el tiempo y por lo tanto el coste del producto final. Son normas de sentido común, pero que seguramente por comodidad o por negar lo que es evidente no se llegan a hacer.</p>
<p>Las he resumido en la siguiente lista:</p>
<h3>1. DEFINIR LOS OBJETIVOS / CARACTERÍSTICAS DEL PRODUCTO</h3>
<p>Para evitar contratiempos y derivaciones de presupuesto es de vital importancia <strong>dejar todo atado antes de empezar a programar / diseñar</strong>. Es de gran ayuda tener definidos los <a href="http://es.wikipedia.org/wiki/Wireframe_(Dise%C3%B1o_web)" title="Wikipedia - wireframes" target="_blank">wireframes</a> y las especificaciones y objetivos de cada apartado.</p>
<p>¿Te imaginas ir a un mecánico después de haberle pedido que te cambie las ruedas de tu coche y le dices que además de la ruedas tiene que darle un toque de pintura y que vas a pagarle lo mismo? ¿A que la situación es surrealista?</p>
<p>La solución por muy aburrida que sea es dejar constancia de que hace exactamente cada elemento del producto. Es necesario. Como clientes ahorraremos en sorpresas y como desarrolladores en control del presupuesto.</p>
<p><br/></p>
<h3>2. CONFIAR EN LOS PROFESIONALES</h3>
<p>A los diseñadores / programadores se nos cuestiona nuestro trabajo continuamente (más a los diseñadores ya que su trabajo es visual). Hay que tener en cuenta que, por lo general, <strong>se contrata a un profesional que normalmente sabe mejor que el cliente como comunicar un diseño o usar una aplicación</strong>.</p>
<p>Como cliente está bien dar pinceladas y apuntar notas para que el desarrollo vaya encaminado a lo que se quiere, pero es contraproducente rectificar diseños y alterar comportamientos de programación cuando los profesionales que has contratado te desaconsejan hacerlo.</p>
<p>Esto puede intoxicar la relación entre ambos. Y es completamente innecesario ya que cuando mejor salen las cosas es cuando hay mutuo acuerdo y no una obligación. Así que un poco de confianza no viene mal. Nadie quiere destrozar tu idea, los desarrolladores buscan lo mejor para todos. ¿Por qué algunos se empeñan en ver las opiniones de un desarrollador como algo malo si lo único que se pretende es mejorar el producto lo máximo posible? Motivación, reputación, profesionalidad, &#8230;</p>
<p><br/></p>
<h3>3. PLATAFORMAS DE DESARROLLO</h3>
<p>A la hora de producir una web o tienda virtual existen dos caminos. Partir de 0 con programación y diseño a medida o escoger alguna de las plataformas o <a href="http://es.wikipedia.org/wiki/Cms" title="Wikipedia - CMS" target="_blank">CMS</a> que existen.</p>
<p>La primera opción, evidentemente, tiene un tiempo de desarrollo y por lo tanto un coste superior. Pero como pro, no tiene las limitaciones que tiene la segunda opción. Y ahí es dónde voy.</p>
<p>Está muy bien elegir el segundo camino porque el presupuesto es reducido o el proyecto es urgente, pero hay que tener claro que <strong>existen ciertas funcionalidades que a priori no se pueden realizar en según que CMS o plataformas</strong>, y si se pudieran elevarían el coste a niveles incluso superiores que habiendo hecho exactamente lo mismo con la primera opción. Esto es así, porque para poder programar o diseñar esas funcionalidades hace falta modificar el núcleo o plugins instalados de los CMS o plataformas, lo cual implica un conocimiento bastante especializado que, por supuesto, se tiene que pagar.</p>
<p>En definitiva, si se elige un desarrollo por CMS o plataformas hay que tener claro hasta dónde podemos llegar y no buscar cabezas de turco cuando surjan derivaciones extremadamente altas en el presupuesto para según que cambios. Aquí es donde entra en acción otra vez el punto 1. ¡Déjalo todo bien atado antes de empezar y prevé modificaciones!</p>
<p><br/></p>
<h3>4. POSICIONAMIENTO &#8211; SEO</h3>
<p>Alguna gente se piensa que con solo hacer una página web por arte de magia aparece en los primeros resultados de Google. Imaginemos la siguiente situación: un casillero de más de 500 millones de casillas y una de las casillas es tu web. ¿Cómo puedes esperar o pretender que una persona normal encuentre la casilla sin tu haberle dicho antes dónde está?<br />
El posicionamiento natural de las webs lo realizan los robots (<a href="http://en.wikipedia.org/wiki/Web_crawler" title="Wikipedia - web crawler" target="_blank">crawlers</a>) de los grandes como Google. En base al contenido que encuentren en tu página la posicionaran mejor para determinadas búsquedas. Pero si ese contenido es escaso y además no es acertado a muy duras penas se escalaran posiciones.</p>
<p>A nivel de programación se puede preparar una web para que el contenido sea mejor interpretado por los crawlers, pero no es suficiente. <strong>El contenido tiene que ser adecuado y amplio</strong>. En este punto es importante que el cliente proporcione toda la información que tenga a su disposición y lo contraste con un equipo de comunicación o directamente con un experto SEO para que se pueda redactar el texto que aparecerá en la web de forma óptima.</p>
<p>Es importante buscar <strong>un equilibrio entre las modificaciones que se deban hacer por motivos de SEO y el aspecto visual de una web</strong>. Muchas veces he presentado una web impecable visualmente y posteriormente ha quedado destrozada por modificaciones en los titulares, texto redundante, etc. No olvidéis que una buena imagen lo es todo una vez has atraído a un posible cliente a tu web. No sirve de nada juntar clientes y que luego huyan despavoridos cuando vean el monstruo que has engendrado.</p>
<p><br/></p>
<h3>5. PRECIO / PRESUPUESTO</h3>
<p>Es extremadamente ofensivo cuando se pide un presupuesto y se intenta regatear o menospreciar el trabajo que se va a realizar. Por ejemplo, yo como programador nunca he cuestionado y pedido justificaciones a un cliente sobre lo que cuesta hacer su trabajo, sin embargo sí que he tenido casos en los que tengo que explicar técnicamente cómo voy a tener programar ciertas funcionalidades.</p>
<p>Es absurdo. La mayoría de veces no entienden la explicación (lo cual es normal) y tengo la sensación que aflora un sentimiento de desconfianza. Así que el consejo es que al igual que debes confiar en el profesional que contratas, ten un poco de <strong>respeto por su trabajo</strong>.</p>
<p><br/></p>
<h3>6. SIMPLIFICA</h3>
<p>Hay que bajarse de las nubes e ir paso a paso a la hora de desarrollar. Como cliente intenta sacar la esencia de la idea y busca desarrolladores. <strong>No añadas más de lo esencial, no ensucies el producto</strong>. Cuanto más simple y bien haga lo que ha de hacer más a gusto estarán los usuarios. A la gente no le gusta lo complicado, no le importa que a ti te haga mucha ilusión, tienen sus propias preocupaciones y quieren algo que comunique lo justo sin adornos.</p>
<p>Como programador o diseñador, cíñete a lo que pide el cliente. Consulta antes de tomar iniciativas. No somos mercenarios a sueldo está claro, pero tampoco somos artistas.</p>
<p><br/><br />
Creo que éstos serían los puntos más críticos para mejorar la relación cliente-desarrollador y para que el producto final, que es lo que queremos todos, sea lo mejor posible. Obviamente no hay que tomárselos al pie de la letra pero si tenerlos en cuenta. Para terminar este wall-of-text os dejo un video para reflexionar y echar unas risas:</p>
<p><br/><br />
<iframe width="720" height="540" src="http://www.youtube.com/embed/rQCsHE8EZ98?rel=0" frameborder="0" allowfullscreen></iframe></p>
<p>La entrada <a rel="nofollow" href="http://blog.jonaszamora.es/consejos-a-la-hora-de-montar-tu-propia-web-o-tienda-virtual/">Consejos a la hora de montar tu propia web o tienda virtual</a> aparece primero en <a rel="nofollow" href="http://blog.jonaszamora.es">Ako&#039;s warehouse</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jonaszamora.es/consejos-a-la-hora-de-montar-tu-propia-web-o-tienda-virtual/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>CodeIgniter: Fix para la pérdida de sesiones causada por Ajax</title>
		<link>http://blog.jonaszamora.es/codeigniter-sesiones-fix/</link>
		<comments>http://blog.jonaszamora.es/codeigniter-sesiones-fix/#comments</comments>
		<pubDate>Tue, 21 May 2013 16:00:19 +0000</pubDate>
		<dc:creator><![CDATA[Jonas Zamora]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[programación web]]></category>

		<guid isPermaLink="false">http://blog.jonaszamora.es/?p=334</guid>
		<description><![CDATA[<p>Trabajando en un nuevo proyecto en CodeIgniter me he encontrado que a la hora de guardar las sesiones en la BD, éstas perdían toda la información que había almacenado en ellas al cambiar de controlador y realizar peticiones Ajax simultáneas. &#8230; <a href="http://blog.jonaszamora.es/codeigniter-sesiones-fix/">Seguir leyendo <span class="meta-nav">></span></a></p>
<p>La entrada <a rel="nofollow" href="http://blog.jonaszamora.es/codeigniter-sesiones-fix/">CodeIgniter: Fix para la pérdida de sesiones causada por Ajax</a> aparece primero en <a rel="nofollow" href="http://blog.jonaszamora.es">Ako&#039;s warehouse</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>Trabajando en un nuevo proyecto en CodeIgniter me he encontrado que a la hora de guardar las sesiones en la BD, éstas perdían toda la información que había almacenado en ellas al cambiar de controlador y realizar peticiones Ajax simultáneas.</p>
<p>La solución la encontré en el repositorio de CodeIgniter. Por lo que vi, es un bug que llevan arrastrando ya desde varias versiones atrás y bastante común entre los desarrolladores de CI.</p>
<p>Para solventar el problema, por ahora, hay que remplazar &#8220;system/libraries/Session.php&#8221; por esta otra <a href="https://github.com/Areson/CodeIgniter/blob/245bef58eea045b1fcf0584049dc430bcb8abc20/system/libraries/Session.php" target="_blank">Areson CI Session.php</a> y guardar la tabla de sesiones con el siguiente script SQL:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">CREATE</span> <span style="color: #990099; font-weight: bold;">TABLE</span> <span style="color: #990099; font-weight: bold;"><span style="color: #009900;">IF</span> <span style="color: #CC0099; font-weight: bold;">NOT</span> EXISTS</span>  <span style="color: #008000;">`ci<span style="color: #008080; font-weight: bold;">_</span>sessions`</span> <span style="color: #FF00FF;">&#40;</span>
    session_id <span style="color: #999900; font-weight: bold;">varchar</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">40</span><span style="color: #FF00FF;">&#41;</span> <span style="color: #990099; font-weight: bold;">DEFAULT</span> <span style="color: #008000;">'0'</span> <span style="color: #CC0099; font-weight: bold;">NOT</span> <span style="color: #9900FF; font-weight: bold;">NULL</span><span style="color: #000033;">,</span>
    ip_address <span style="color: #999900; font-weight: bold;">varchar</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">45</span><span style="color: #FF00FF;">&#41;</span> <span style="color: #990099; font-weight: bold;">DEFAULT</span> <span style="color: #008000;">'0'</span> <span style="color: #CC0099; font-weight: bold;">NOT</span> <span style="color: #9900FF; font-weight: bold;">NULL</span><span style="color: #000033;">,</span>
    user_agent <span style="color: #999900; font-weight: bold;">varchar</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">120</span><span style="color: #FF00FF;">&#41;</span> <span style="color: #CC0099; font-weight: bold;">NOT</span> <span style="color: #9900FF; font-weight: bold;">NULL</span><span style="color: #000033;">,</span>
    last_activity <span style="color: #999900; font-weight: bold;">int</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">10</span><span style="color: #FF00FF;">&#41;</span> <span style="color: #FF9900; font-weight: bold;">unsigned</span> <span style="color: #990099; font-weight: bold;">DEFAULT</span> <span style="color: #008080;">0</span> <span style="color: #CC0099; font-weight: bold;">NOT</span> <span style="color: #9900FF; font-weight: bold;">NULL</span><span style="color: #000033;">,</span>
    user_data <span style="color: #999900; font-weight: bold;">text</span> <span style="color: #CC0099; font-weight: bold;">NOT</span> <span style="color: #9900FF; font-weight: bold;">NULL</span><span style="color: #000033;">,</span>
    prevent_update <span style="color: #999900; font-weight: bold;">int</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">10</span><span style="color: #FF00FF;">&#41;</span> <span style="color: #990099; font-weight: bold;">DEFAULT</span> <span style="color: #9900FF; font-weight: bold;">NULL</span><span style="color: #000033;">,</span>
    <span style="color: #990099; font-weight: bold;">PRIMARY KEY</span> <span style="color: #FF00FF;">&#40;</span>session_id<span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">,</span>
    <span style="color: #990099; font-weight: bold;">KEY</span> <span style="color: #008000;">`last<span style="color: #008080; font-weight: bold;">_</span>activity<span style="color: #008080; font-weight: bold;">_</span>idx`</span> <span style="color: #FF00FF;">&#40;</span><span style="color: #008000;">`last<span style="color: #008080; font-weight: bold;">_</span>activity`</span><span style="color: #FF00FF;">&#41;</span>
<span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span></pre></td></tr></table></div>

<p>Más info:<br />
<a href="https://github.com/EllisLab/CodeIgniter/pull/1283" target="_blank">Enable simultaneous AJAX requests to work with sessions</a></p>
<p>La entrada <a rel="nofollow" href="http://blog.jonaszamora.es/codeigniter-sesiones-fix/">CodeIgniter: Fix para la pérdida de sesiones causada por Ajax</a> aparece primero en <a rel="nofollow" href="http://blog.jonaszamora.es">Ako&#039;s warehouse</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jonaszamora.es/codeigniter-sesiones-fix/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Columpia.me, experimentando con SVG y jQuery Rotate</title>
		<link>http://blog.jonaszamora.es/columpia-me-experimentando-con-svg-y-jquery-rotate/</link>
		<comments>http://blog.jonaszamora.es/columpia-me-experimentando-con-svg-y-jquery-rotate/#comments</comments>
		<pubDate>Fri, 15 Feb 2013 12:10:11 +0000</pubDate>
		<dc:creator><![CDATA[Jonas Zamora]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[experimentos]]></category>
		<category><![CDATA[programación web]]></category>

		<guid isPermaLink="false">http://blog.jonaszamora.es/?p=314</guid>
		<description><![CDATA[<p>Hacía tiempo que tenía ganas de programar algo sin sentido, sólo para divertirme. Todo empezó en una de esas tardes tan normales. Ya sabéis, de las que te tiras 4 horas buscando dominios para una aplicación web que se te &#8230; <a href="http://blog.jonaszamora.es/columpia-me-experimentando-con-svg-y-jquery-rotate/">Seguir leyendo <span class="meta-nav">></span></a></p>
<p>La entrada <a rel="nofollow" href="http://blog.jonaszamora.es/columpia-me-experimentando-con-svg-y-jquery-rotate/">Columpia.me, experimentando con SVG y jQuery Rotate</a> aparece primero en <a rel="nofollow" href="http://blog.jonaszamora.es">Ako&#039;s warehouse</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>Hacía tiempo que tenía ganas de programar algo sin sentido, sólo para divertirme.<br />
Todo empezó en una de esas tardes tan normales. Ya sabéis, de las que te tiras 4 horas buscando dominios para una aplicación web que se te acaba de ocurrir.</p>
<p>Bueno, el dominio que buscaba no lo encontré. De hecho aún sigo dándole vueltas (maldita especulación de dominios!). Sin embargo, compré <a href="http://columpia.me" title="Columpia.me" target="_blank">columpia.me</a>. No sé, supongo que me hizo gracia y en ese momento estaba seguro que algo se me ocurriría con él.</p>
<p>Lo que estaba claro es que tendría que aparecer algún tipo de columpio, así que abrí Photoshop y le di a la pluma <em>like a pro</em>.</p>
<p>Después, con Ilustrator acabé el personaje y el escenario y me puse a buscar una librería de jQuery de rotaciones para animar el personaje. La idea que tenía en mente era que se pudiera arrastrar al monigote y al soltarlo se columpiara hasta pararse.</p>
<p>Di con <a href="http://ricostacruz.com/jquery.transit/" target="_blank" title="jQuery Transit">jQuery Transit</a>. Es una librería interesante. Permite crear animaciones de transformaciones sobre un selector jQuery utilizando CSS. Estuve probando, y a pesar que las transiciones eran muy suaves al final desistí, ya que no incorporaba un método para controlar la parada de éstas.</p>
<p>Buscando alternativas encontré <a href="http://code.google.com/p/jqueryrotate/" target="_blank" title="jQuery Rotate">jQuery Rotate</a>, que pese a que a simple vista pueda parecer mucho menos elaborado, funciona perfectamente y además permite controlar la parada de la transición.</p>
<p>El uso también es sencillo, por ejemplo, para mover el columpio, basta con utilizar esta porción de código:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span>foo<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">rotate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
        angle<span style="color: #339933;">:</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">getRotateAngle</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
	animateTo<span style="color: #339933;">:</span> angleDest<span style="color: #339933;">,</span>
	easing<span style="color: #339933;">:</span> transition<span style="color: #339933;">,</span>
	duration<span style="color: #339933;">:</span> time
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Donde angle es el ángulo actual, animateTo el ángulo de destino, easing la función de movimiento / aceleración y duration el tiempo que dura la transición.</p>
<p>Y lo más importante, para parar esa transición (útil cuando se interactúa con el personaje), se llama al método <em>stopRotate</em>.</p>
<p>Al final quedó esto:</p>
<p><img src="http://blog.jonaszamora.es/wp-content/uploads/2013/02/happy.jpg" alt="" title="Columpiame" width="1051" height="604" class="aligncenter size-full wp-image-328" /></p>
<p>La entrada <a rel="nofollow" href="http://blog.jonaszamora.es/columpia-me-experimentando-con-svg-y-jquery-rotate/">Columpia.me, experimentando con SVG y jQuery Rotate</a> aparece primero en <a rel="nofollow" href="http://blog.jonaszamora.es">Ako&#039;s warehouse</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jonaszamora.es/columpia-me-experimentando-con-svg-y-jquery-rotate/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Snippet: obtener miniaturas de Vimeo</title>
		<link>http://blog.jonaszamora.es/php-snippet-obtener-miniaturas-de-vimeo/</link>
		<comments>http://blog.jonaszamora.es/php-snippet-obtener-miniaturas-de-vimeo/#comments</comments>
		<pubDate>Wed, 23 Jan 2013 09:00:48 +0000</pubDate>
		<dc:creator><![CDATA[Jonas Zamora]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[programación web]]></category>

		<guid isPermaLink="false">http://blog.jonaszamora.es/?p=286</guid>
		<description><![CDATA[<p>Hoy me he encontrado con la necesidad de programar una galería de videos subidos a Vimeo. La galería era una lista de imágenes. Estas imágenes eran vistas previas de los videos que se querían mostrar más adelante en una página &#8230; <a href="http://blog.jonaszamora.es/php-snippet-obtener-miniaturas-de-vimeo/">Seguir leyendo <span class="meta-nav">></span></a></p>
<p>La entrada <a rel="nofollow" href="http://blog.jonaszamora.es/php-snippet-obtener-miniaturas-de-vimeo/">PHP Snippet: obtener miniaturas de Vimeo</a> aparece primero en <a rel="nofollow" href="http://blog.jonaszamora.es">Ako&#039;s warehouse</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>Hoy me he encontrado con la necesidad de programar una galería de videos subidos a Vimeo.<br />
La galería era una lista de imágenes. Estas imágenes eran vistas previas de los videos que se querían mostrar más adelante en una página detallada.</p>
<p>Para no tener que realizar capturas de todos los videos he estado trasteando un poco la <a href="http://developer.vimeo.com/apis/simple#video-request" target="_blank" title="Vimeo API">API de Vimeo</a> intentando averiguar si generaba vistas previas de forma automática. Y, en efecto, lo permite.</p>
<p>Con este pequeño snippet de código se pueden recuperar las imágenes de cualquier video de Vimeo utilizando su URL.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$id</span> <span style="color: #339933;">=</span> <span style="color: #339933;">&lt;</span>insertar ID del video<span style="color: #339933;">&gt;;</span>
<span style="color: #000088;">$vimeo</span> <span style="color: #339933;">=</span> <span style="color: #990000;">unserialize</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">file_get_contents</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;http://vimeo.com/api/v2/video/<span style="color: #006699; font-weight: bold;">$id</span>.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$small</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$vimeo</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'thumbnail_small'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$medium</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$vimeo</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'thumbnail_medium'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$large</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$vimeo</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'thumbnail_large'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Por ejemplo para el video:<br />
vimeo.com/15786406</p>
<p>bastaría con utilizar el snippet y asignar a $id el número 15786406. En las variables $small, $medium y $large tendríamos las imágenes pequeña, mediana y grande respectivamente.</p>
<p>La entrada <a rel="nofollow" href="http://blog.jonaszamora.es/php-snippet-obtener-miniaturas-de-vimeo/">PHP Snippet: obtener miniaturas de Vimeo</a> aparece primero en <a rel="nofollow" href="http://blog.jonaszamora.es">Ako&#039;s warehouse</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jonaszamora.es/php-snippet-obtener-miniaturas-de-vimeo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>¿Cómo ha ido el 2012 para los desarrolladores web?</title>
		<link>http://blog.jonaszamora.es/como-ha-ido-el-2012-para-los-desarrolladores-web/</link>
		<comments>http://blog.jonaszamora.es/como-ha-ido-el-2012-para-los-desarrolladores-web/#comments</comments>
		<pubDate>Sat, 29 Dec 2012 18:53:07 +0000</pubDate>
		<dc:creator><![CDATA[Jonas Zamora]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[miscelánea]]></category>
		<category><![CDATA[programación web]]></category>

		<guid isPermaLink="false">http://blog.jonaszamora.es/?p=263</guid>
		<description><![CDATA[<p>Design Shack ha realizado un estudio sobre la situación de los desarrolladores web en el año 2012 con una muestra de 500 personas. Los resultados han sido resumidos en una infografía. El dato que más gracia me ha hecho es &#8230; <a href="http://blog.jonaszamora.es/como-ha-ido-el-2012-para-los-desarrolladores-web/">Seguir leyendo <span class="meta-nav">></span></a></p>
<p>La entrada <a rel="nofollow" href="http://blog.jonaszamora.es/como-ha-ido-el-2012-para-los-desarrolladores-web/">¿Cómo ha ido el 2012 para los desarrolladores web?</a> aparece primero en <a rel="nofollow" href="http://blog.jonaszamora.es">Ako&#039;s warehouse</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p><strong>Design Shack</strong> ha realizado un estudio sobre la situación de los desarrolladores web en el año 2012 con una muestra de 500 personas. Los resultados han sido resumidos en una infografía.</p>
<p>El dato que más gracia me ha hecho es el 88% de desarrolladores que asegura que sus clientes no ven justificados los precios. Y el que más me ha sorprendido, es el que 4 de cada 5 tienen serias dificultades para encontrar nuevos proyectos. Me identifico con ellos, pero no tenía ni idea que era tan apabullante como un 80%.</p>
<p>Otros datos menos sorprendentes son el 78% de hombres vs. el 22% de mujeres como desarrolladores o el 90% de desarrolladores que creen que ha incrementado la demanda de sites adaptados a dispositivos móviles.</p>
<p>Os dejo la infografía:</p>
<p><img src="http://blog.jonaszamora.es/wp-content/uploads/2012/12/the-anatomy-of-a-web-designer-infographic.jpg" alt="" title="The anatomy of a web designer infographic" width="960" height="2159" class="aligncenter size-full wp-image-264" /></p>
<p><a href="http://designshack.net/articles/design-shack/the-web-design-survey-2012-the-results-are-in/" title="The Web Design Survey 2012: The Results Are In!" target="_blank">Fuente >></a></p>
<p>La entrada <a rel="nofollow" href="http://blog.jonaszamora.es/como-ha-ido-el-2012-para-los-desarrolladores-web/">¿Cómo ha ido el 2012 para los desarrolladores web?</a> aparece primero en <a rel="nofollow" href="http://blog.jonaszamora.es">Ako&#039;s warehouse</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jonaszamora.es/como-ha-ido-el-2012-para-los-desarrolladores-web/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>8 librerías para Javascript obligatorias</title>
		<link>http://blog.jonaszamora.es/8-librerias-para-javascript-obligatorias/</link>
		<comments>http://blog.jonaszamora.es/8-librerias-para-javascript-obligatorias/#comments</comments>
		<pubDate>Mon, 24 Dec 2012 09:55:27 +0000</pubDate>
		<dc:creator><![CDATA[Jonas Zamora]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[programación web]]></category>

		<guid isPermaLink="false">http://blog.jonaszamora.es/?p=238</guid>
		<description><![CDATA[<p>La mayoría de veces que he desarrollado alguna página o aplicación web he recurrido a una serie de librerías que, entre otras cosas, me han ahorrado muchísimo tiempo y mejorado la lectura de mi código. Este es mi top 8: &#8230; <a href="http://blog.jonaszamora.es/8-librerias-para-javascript-obligatorias/">Seguir leyendo <span class="meta-nav">></span></a></p>
<p>La entrada <a rel="nofollow" href="http://blog.jonaszamora.es/8-librerias-para-javascript-obligatorias/">8 librerías para Javascript obligatorias</a> aparece primero en <a rel="nofollow" href="http://blog.jonaszamora.es">Ako&#039;s warehouse</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>La mayoría de veces que he desarrollado alguna página o aplicación web he recurrido a una serie de librerías que, entre otras cosas, me han ahorrado muchísimo tiempo y mejorado la lectura de mi código.<br />
Este es mi top 8:</p>
<ul>
<li>
<p><strong>1. jQuery</strong>:</p>
<p>Funciona como un nivel superior de JS. Con ella se puede desarrollar en ámbito web de una manera mucho cómoda, rápida, fácil y legible. <a href="http://jquery.com/" title="jQuery" target="_blank">Página de jQuery</a></p>
</li>
<li>
<p><strong>2. jQuery UI</strong>:</p>
<p>Complementa a jQuery como su nombre indica en términos de <em>User Interface</em>. Esta librería permite controlar fácilmente elementos de navegación como menús, tabs, botones, y un largo etc. a base de widgets. También resulta muy útil el set de interacciones que tiene implementado. <a href="http://jqueryui.com/" title="jQuery UI" target="_blank">Página de jQuery UI</a></p>
</li>
<li>
<p><strong>3. jQuery easing</strong>:</p>
<p>Muy útil a la hora de animar transiciones para cualquier selector de jQuery. Actualmente se puede prescindir de ella gracias a las transiciones de CSS3, pero teniendo en cuenta que navegadores como Internet Explorer no soportan CSS3, easing es muy buena elección. <a href="http://gsgd.co.uk/sandbox/jquery/easing/" title="jQuery easing" target="_blank">Página de jQuery easing</a></p>
</li>
<li>
<p><strong>4. Modernizr</strong>:</p>
<p>¿Problemas con Internet Explorer para que reconozca HTML5 o CSS3? Échale un ojo a Modernizr. <a href="http://modernizr.com/" title="Modernizr" target="_blank">Página de Modernizr</a></p>
</li>
<li>
<p><strong>5. Explorer Canvas</strong>:</p>
<p>De nuevo nuestro querido Explorer es el protagonista aquí. Esta librería permite utilizar canvas en él. <a href="http://code.google.com/p/explorercanvas/source/browse/trunk/silverlight/excanvas.js?r=48" title="Excanvas" target="_blank">Página de Explorer Canvas</a></p>
</li>
<li>
<p><strong>6. Google Maps API</strong>:</p>
<p>El 50%, y quizás me quede corto, de cualquier página de empresa lleva algún mapa incorporado para anunciar su ubicación. GM permite definir y personalizar estos mapas, más allá de lo que se puede ver en <em>maps.google.com</em>. <a href="https://developers.google.com/maps/documentation/" title="Google Maps API" target="_blank">Página de Google Maps Developers</a></p>
</li>
<li>
<p><strong>7. Handlebars</strong>:</p>
<p>Es una extensión a <a href="http://mustache.github.com/" title="Mustache" target="_blank">Mustache</a>. Tiene la capacidad de poder construir plantillas semánticas para después compilarlas a código. <a href="http://handlebarsjs.com/" title="Handlebars" target="_blank">Página de Handlebars</a></p>
</li>
<li>
<p><strong>8. Tipped</strong>:</p>
<p>A pesar de ser una librería que no tiene una utilidad muy destacable (crear tooltips en forma de globo). Es una muy buena herramienta para sustituir el formato de los <em>alts</em> y <em>titles</em> de las imágenes de una página por algo más moderno y personalizado. <a href="http://projects.nickstakenburg.com/tipped" title="Tipped" target="_blank">Página de Tipped</a></p>
</li>
</ul>
<p>La entrada <a rel="nofollow" href="http://blog.jonaszamora.es/8-librerias-para-javascript-obligatorias/">8 librerías para Javascript obligatorias</a> aparece primero en <a rel="nofollow" href="http://blog.jonaszamora.es">Ako&#039;s warehouse</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jonaszamora.es/8-librerias-para-javascript-obligatorias/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
