Skip to content

Instantly share code, notes, and snippets.

View jtechera's full-sized avatar

Juan Techera jtechera

  • Uruguay
  • 09:42 (UTC -03:00)
View GitHub Profile
/*If you are using jQuery, you can get the size of the window or the document using jQuery methods:*/
$(window).height(); // returns height of browser viewport
$(document).height(); // returns height of HTML document (same as pageHeight in screenshot)
$(window).width(); // returns width of browser viewport
$(document).width(); // returns width of HTML document (same as pageWidth in screenshot)
/*For screen size you can use the screen object in the following way:*/
screen.height;
screen.width;
@jtechera
jtechera / commands.sh
Last active February 8, 2017 19:57
Ionic commands and tools
INSTALL:
npm install -g cordova ionic
UNINSTALL:
npm uninstall -g ionic npm cache clean
START PROJECT:
ionic start --v2 myApp blank|tabs|sidemenu|tutorial
RUN IN LAB MODE
@jtechera
jtechera / dowjones.php
Created February 7, 2017 14:29
Get Dow Jones from Yahoo (not sure if it breaks TOS)
<?php
function getDowJones()
{
$rawData = file_get_contents("http://chartapi.finance.yahoo.com/instrument/1.0/%5Edji/chartdata;type=quote;range=1d/csv/");
$data = explode("\n", trim($rawData));
$csvData = $data[count($data)-1];
$arrayDJI = explode(",", $csvData);
return number_format((float)$arrayDJI[4], 2, ',', '');
@jtechera
jtechera / cotizaciones.php
Last active February 13, 2019 00:41
Cotizacion de monedas y U.I. desde el BCU (Uruguay)
<?php
function getCotizaciones($monedas = true)
{
$url = 'http://www.bcu.gub.uy/_layouts/BCU.Cotizaciones/handler/CotizacionesHandler.ashx?op=getcotizaciones';
$data = "";
$last_date_found = false;
$diff = 1;
$cotizaciones = array();
$codigosAceptados = array("USD", "EURO", "CHF", "GBP", "ARS", "BRL", "JPY", "U.I.");
@jtechera
jtechera / show_errors.php
Last active February 8, 2017 14:00
Show PHP errors
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);