Skip to content

Instantly share code, notes, and snippets.

View ghacosta's full-sized avatar

Guille Acosta ghacosta

View GitHub Profile
@ghacosta
ghacosta / blackscholes.js
Created July 23, 2020 04:24 — forked from vorandrew/blackscholes.js
Black-Scholes in Javascript: A rewrite of http://www.espenhaug.com/black_scholes.html
/*
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 July 3, 2020 16:44
react-select + apollo + async + debounce helpful links
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 October 30, 2019 15:11
Rename css file to scss
for file in $(find . -name "*.css"); do mv ${file} ${file%.css}.scss; done
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 July 25, 2018 22:39
Send emails using gmail SMTP and PHPMailer
<?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';
https://hangouts.google.com/call/K64mlXsN49eYCsQOPiPzAAEE
@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>
@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 / 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);