Skip to content

Instantly share code, notes, and snippets.

View edinsoncs's full-sized avatar
🤖
Working from home

Edinson CS edinsoncs

🤖
Working from home
View GitHub Profile
@edinsoncs
edinsoncs / calculadoraporcentaje.js
Created December 31, 2015 14:58
Function Porcentaje
/*Calculadora Porcentaje*/
var t = prompt('ingresa algo');
function aPorcentaje(num) {
var a = num;
var result = a / 12 * 100
return result
var question = prompt('Ingresa la cantidad');
var question_Two = prompt('Data');
function redondeo(cantidad) {
var a = cantidad;
return a;
}
function nacidos(cantidad, vivos, fallecidos) {
var a = cantidad;
@edinsoncs
edinsoncs / api.js
Created December 31, 2015 22:58
api
(function(){
var xhr = new XMLHttpRequest;
var API = "https://en.wikipedia.org/w/api.php?action=query&format=json&list=search&srsearch";
var SEARCH = prompt("Que vas a buscar?");
xhr.onreadystatechange = function(){
if (xhr.readyState == 4 && xhr.status == 200) {
JSON.parse(xhr.responseText);
}
@edinsoncs
edinsoncs / buscandodni.js
Created January 5, 2016 23:07
buscandodni
function search(dni) {
var save = {};
var a = dni;
save = a;
var b = prompt("ingresa el dni");
if(typeof save == toString()) {
return "hola";
}
@edinsoncs
edinsoncs / match.js
Created January 27, 2016 05:06
match
function toMatch(string) {
var eString = string;
var toExpression = /[A-Z]/gi;
var result;
var match = eString.match(toExpression);
var i = 0;
while(i < match.length) {
console.log(i);
i++;
@edinsoncs
edinsoncs / less.less
Created February 11, 2016 03:24
Less
Less pro by edinson carranza
@varUno: blue;
@varDos: green;
* {
box-sizing: border-box;
}
//Añadimiento normal en less
/*
@edinsoncs
edinsoncs / 1.js
Created February 16, 2016 00:57
cv in javascript
//javascript object in function
//cv in jss
var question = prompt('ingresa el nombre');
var micv = {
nombre: 'Edinson',
surname: 'Carranza',
form: function(city){
var title = "Soy de: ";
return title + city;
},
@edinsoncs
edinsoncs / 2.js
Created February 22, 2016 05:11
Javascript Map function
//Map in javascripts
//map se pasa 3 parametros - currentValue, Index, Arr
function mapOne(){
var miArray = [1, 2, 3];
var incremento = 1;
miArray.map(function(multiplicar, indice, array){
console.log('Muestro el indice de mi array' + indice);
@edinsoncs
edinsoncs / 3.js
Created February 26, 2016 05:30
toDateString
//toDatestring
function toDate(data) {
var data = new Date(2016, 25, 06);
return data.toDateString();
}
@edinsoncs
edinsoncs / 1.js
Created February 28, 2016 19:25
1 nodejs
//'use strict';
var http = require('http');
var puerto = '3000';
http.createServer(function(req, res){
//respondemos nuestro head con el status
res.writeHead(200, {'Content-type': 'text/html'});
res.end('<h1>Hello Nodejs</h1>');
}).listen(puerto, function(){
console.log('esta corriendo server ' + puerto)