Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
making music at https://alcomusic.com

Alco ricardoalcocer

💭
making music at https://alcomusic.com
View GitHub Profile
@ricardoalcocer
ricardoalcocer / progression_generator.js
Last active Jan 30, 2021
Chord Progression Generator
View progression_generator.js
// you can run this at https://jsbin.com/lohoval/7/edit?js,console
var progression = function(){
var currentKey = "";
var chords = {
"A" : ["A", "Bmin", "C#min", "D", "E", "F#min", "G#°"],
"B" : ["B", "C#min", "D#min", "E", "F", "G#min", "A#°"],
"C" : ["C", "Dmin", "Emin", "F", "G", "Amin", "B°"],
"D" : ["D", "Emin", "F#min", "G", "A", "Bmin", "C#°"],
"E" : ["E", "F#min", "G#min", "A", "B", "C#min", "D#°"],
View clubhouse.md

Clubhouse will be bought out, probably pretty soon and I think the buyout is going to be Spotify.

Clubhouse has 600,000 monthly active users. Celebrity users including Drake, Ashton Kutcher, Jared Leto & Chris Rock. Launch in May 2020.

600,000 users on social isn’t a lot to brag about, but the platform has been invite only and compared to Google+ which launched in 2011 and failed, Clubhouse is maintaining much stronger user engagement times.

On top of that, average user age is 35 and it’s run a near perfect 50/50 in men to women, which is the most valuable demographic to get for advertisers.

View snippet.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script lang="javascript">
var module = function(){
@ricardoalcocer
ricardoalcocer / .htaccess
Last active Nov 20, 2020
iTransfer - Like we transfer but not as good
View .htaccess
Options -Indexes
RewriteEngine On
################################################################
## ROUTES
################################################################
RewriteRule ^f/([A-Za-z0-9-\s]+)/?$ ./gf.php?f=$1 [NC,L]
View jsxhr.js
function xhr(method, uri, body, handler) {
var req = (window.XMLHttpRequest) ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP');
req.onreadystatechange = function ()
{
if (req.readyState == 4 && handler)
{
eval('var o=' + req.responseText);
handler(o);
}
}
View Copy RSA key to server.md

RSA KEYS

If you haven't already got a ~/.ssh/id_rsa.pub on your computer, you'll need to generate one.

To generate key

ssh-keygen

To copy ssh key to your clipboard on a mac:

View gravatarfromemail.php
<?php
$userMail = 'kevinrose@gmail.com';
$imageWidth = '150'; //The image size
$imgUrl = 'http://www.gravatar.com/avatar/'.md5($userMail).'fs='.$imageWidth;
echo "<img src=\"$imgUrl\">";
?>
@ricardoalcocer
ricardoalcocer / short-number-format.php
Created Aug 11, 2020 — forked from RadGH/short-number-format.php
Short Number Formatter for PHP (1000 to 1k; 1m; 1b; 1t)
View short-number-format.php
<?php
// Converts a number into a short version, eg: 1000 -> 1k
// Based on: http://stackoverflow.com/a/4371114
function number_format_short( $n, $precision = 1 ) {
if ($n < 900) {
// 0 - 900
$n_format = number_format($n, $precision);
$suffix = '';
} else if ($n < 900000) {
@ricardoalcocer
ricardoalcocer / README.md
Created Jul 8, 2020
In PHP, take a query string and convert it into an SQL String
View README.md

Sample usage

$qs = "?@fields=name,id&@where=name[ne]john+doe&@limit=0&@offset=100&@order=-timestamp";

$theClass = new queryStringToSQL('users'); // pass in the name of the table

$sqlString = $theClass->getSQLString($qs); // pass in the query string
View CountUpTimer.kt
import android.os.CountDownTimer
abstract class CountUpTimer protected constructor(private val duration: Long) :
CountDownTimer(duration, INTERVAL_MS) {
abstract fun onTick(second: Int)
override fun onTick(msUntilFinished: Long) {
val second = ((duration - msUntilFinished) / 1000).toInt()
onTick(second)
}