Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View ghacosta's full-sized avatar

Guille Acosta ghacosta

View GitHub Profile
@ghacosta
ghacosta / StopWatch.php
Last active October 6, 2015 17:34 — forked from phybros/StopWatch.php
A simple "StopWatch" class to measure PHP execution time. The class can handle multiple separate timers at the same time.
<?php
class StopWatch {
/**
* @var $start float The start time of the StopWatch
*/
private static $startTimes = array();
/**
* Start the timer
*
cordova plugin add https://github.com/brodysoft/Cordova-SQLitePlugin.git
@ghacosta
ghacosta / urlobject.js
Created October 25, 2015 05:58 — forked from aymanfarhat/urlobject.js
JS utility function that: - Breaks down url to an object with accessible properties: protocol, parameters object, host, hash, etc... - Converts url parameters to key/value pairs - Convert parameter numeric values to their base types instead of strings - Store multiple values of a parameter in an array - Unescape parameter values
function urlObject(options) {
"use strict";
/*global window, document*/
var url_search_arr,
option_key,
i,
urlObj,
get_param,
key,
@ghacosta
ghacosta / index.html
Last active January 25, 2016 17:45
initial bootstrap file with CDN and first container, row and col. #BootstrapFromScratch
<!DOCTYPE html>
<html>
<head>
<title></title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous">
@ghacosta
ghacosta / echo_in_loop.php
Last active January 14, 2016 18:29
enabling echo in real time flushing buffer.
<?php
// Turn off output buffering
ini_set('output_buffering', 'off');
// Turn off PHP output compression
ini_set('zlib.output_compression', false);
//Flush (send) the output buffer and turn off output buffering
while(@ob_end_flush());
// Implicitly flush the buffer(s)
@ghacosta
ghacosta / memory_limit_usage_percent.php
Last active January 18, 2016 15:03
Memory limit vs usage percent
<?php
$memory_limit = (int)trim(ini_get("memory_limit"),'M');
function echo_memory_usage() {
$mem_usage = memory_get_usage(true);
if ($mem_usage < 1024)
echo $mem_usage." bytes";
elseif ($mem_usage < 1048576) {
echo "memory usage: ".round($mem_usage/1024,2)." kilobytes"."<br>";
echo "percent usage:".round((($mem_usage/1024) * 100 / ($GLOBALS['memory_limit'] * 1024)),2)."%"."<br>";
}
@ghacosta
ghacosta / using_images.php
Created February 3, 2016 18:53
PHP GD: Create a blank background, resize other image and merge it with the background
<?php
// could be useful http://stackoverflow.com/questions/16774521/scale-image-using-php-and-maintaining-aspect-ratio
// El archivo
$nombre_archivo = 'inverco-sa';
$mime_type = '.png';
// Create a 210x210 image
$im = imagecreatetruecolor(210, 210);
$white = imagecolorallocate($im, 255, 255, 255);
@ghacosta
ghacosta / aerodynamic.rb
Created April 30, 2018 03:44
sonic pi aerodynamic daft punk
use_bpm 123
maquillage = "~/Samples/il-macquillage-lady.wav"
aerodynamic = "~/Samples/funk.wav"
load_sample maquillage
load_sample aerodynamic
define :sample_chunk do |what, beat, dur, delay|
beat = beat / 16.0
@ghacosta
ghacosta / clase04_html
Last active May 4, 2018 00:07
clase_04
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Clase 4</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<nav>
<ul>
https://hangouts.google.com/call/K64mlXsN49eYCsQOPiPzAAEE