Skip to content

Instantly share code, notes, and snippets.

Avatar

Guille Acosta ghacosta

View GitHub Profile
View blackscholes.js
/*
PutCallFlag: Either "put" or "call"
S: Stock Price
X: Strike Price
T: Time to expiration (in years)
r: Risk-free rate
v: Volatility
This is the same one found in http://www.espenhaug.com/black_scholes.html
but written with proper indentation and a === instead of == because it's
@ghacosta
ghacosta / gist:8f4553ca4297d0c3cd73770f7fdc351b
Created Jul 3, 2020
react-select + apollo + async + debounce helpful links
View gist:8f4553ca4297d0c3cd73770f7fdc351b
https://react-select.com/async - official docs
https://github.com/apollographql/apollo-client/issues/5268 - working with apollo
https://codesandbox.io/s/react-select-with-uselazequery-5bkpt?file=/src/index.js - select + useLazyQuery example
https://codesandbox.io/s/98vxxr18zw?file=/example.js - async debouce example
https://stackoverflow.com/questions/52695414/react-select-with-react-apollo-does-not-work - async + apollo client
@ghacosta
ghacosta / one-line-bash-renamer
Created Oct 30, 2019
Rename css file to scss
View one-line-bash-renamer
for file in $(find . -name "*.css"); do mv ${file} ${file%.css}.scss; done
View gist:dcacedcf8224b9db0a4280b3d397c697
var sitesList = [
["http://heeeeeeeey.com/"],
["http://tinytuba.com/"],
["http://corndog.io/"],
["http://thatsthefinger.com/"],
["http://cant-not-tweet-this.com/"],
["http://weirdorconfusing.com/"],
["https://www.eyes-only.net/"],
["http://eelslap.com/"],
["http://www.staggeringbeauty.com/"],
@ghacosta
ghacosta / send-email.php
Last active Jul 25, 2018
Send emails using gmail SMTP and PHPMailer
View send-email.php
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
require '../vendor/autoload.php';
function sendemail($para, $nombre, $cuerpo, $asunto) {
$mail = new PHPMailer;
$mail->isSMTP();
$mail->SMTPDebug = 2;
$mail->Host = 'smtp.gmail.com';
View class.txt
https://hangouts.google.com/call/K64mlXsN49eYCsQOPiPzAAEE
View clase04_html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Clase 4</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<nav>
<ul>
@ghacosta
ghacosta / aerodynamic.rb
Created Apr 30, 2018
sonic pi aerodynamic daft punk
View aerodynamic.rb
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 / using_images.php
Created Feb 3, 2016
PHP GD: Create a blank background, resize other image and merge it with the background
View using_images.php
<?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 / memory_limit_usage_percent.php
Last active Jan 18, 2016
Memory limit vs usage percent
View memory_limit_usage_percent.php
<?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>";
}