Skip to content

Instantly share code, notes, and snippets.

View alejandrorangel's full-sized avatar

Alejandro Rangel alejandrorangel

View GitHub Profile
function padmeHearts(num){
let char = ""
for(let i=0; i < num; i++){
char += "♥";
console.log(char)
}
}
@alejandrorangel
alejandrorangel / Script.js
Created July 8, 2016 19:38
Script to show the behavior of callbacks and promises
(()=>{
console.log("start");
secondFunction().then(function(secondNumber){
console.log("result first promise "+secondNumber);
});
myFunction((newNumber)=>{
var lNumber = 20 + newNumber;
console.log(lNumber);
});
console.log("end");
package main
import (
"bufio"
"fmt"
"os"
"strconv"
"strings"
)
function detectBrowser(userAgent){
var chrome = /.*(Chrome\/).*(Safari\/).*/g;
var firefox = /.*(Firefox\/).*/g;
var safari = /.*(Version\/).*(Safari\/).*/g;
var opera = /.*(Chrome\/).*(Safari\/).*(OPR\/).*/g;
var edge = /.*(Chrome\/).*(Safari\/).*(Edge\/).*/g;
var ie = /.*(Trident\/7).*(rv:).*/g;
if(opera.exec(userAgent))
return "Opera";
function(){
a;
b();
var a = ()=>{
console.log("Print #1");
}
function b(){
console.log("Print #2");
}
}
function Product() {
this.type = "";
this.color = "";
this.getInfo = function() {
return this.color + ' ' + this.type;
};
}
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -
function Product() {
this.type = "";
function fibonacci (mValue){
if(mValue <2)
return 1;
else{
return fibonacci(mValue-2) + fibonacci(mValue -1);
}
}
var cache = [];
function fibonacciCache (mValue){
/*
Copyright Spotify AB 2012-2014. All rights reserved.
History.getInternetExplorerMajorVersion()
Get's the major version of Internet Explorer
@return {integer}
@license Public Domain
@author Benjamin Arthur Lupton <contact@balupton.com>
@author James Padolsey <https://gist.github.com/527683>
@alejandrorangel
alejandrorangel / Card.js
Last active January 30, 2016 02:55
Poker Game in Node.js
Class Card {
constructor(simbol, value) {
this.simbol = simbol;
this.value = value;
}
get kind () {
//wtf?
return simbol.kind;
}
@alejandrorangel
alejandrorangel / script
Last active August 29, 2015 14:20
This script get the ranges of the audio samples and create csv of the samples
import csv, glob, os, sys
SAMPLES = 100 #100 samples = 1 second
DIRECTORY = raw_input("Enter the path of your files: ")
RANGE_DIRECTORY = DIRECTORY+'ranges/'
TALKER_HEADER = 'person'
PITCH_HEADER = 'F0_Hz'
RANGE_HEADER = 'range'
def calculateRange(window):