Skip to content

Instantly share code, notes, and snippets.

View carloscarvallo's full-sized avatar
🏠
Working from home

Carlos Carvallo carloscarvallo

🏠
Working from home
View GitHub Profile
@carloscarvallo
carloscarvallo / clockAngles.js
Created November 2, 2022 19:46
Solution for Clock Angles
function calculate(h, m) {
let minuteDegree = m * 6;
let hourDegree = h * 30 + (30 * m) / 60;
return Math.abs(hourDegree - minuteDegree);
}
@carloscarvallo
carloscarvallo / CrowdFunding.sol
Created December 27, 2021 19:26
Crowdfunding with author verification
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
contract CrowdFunding {
string public id;
string public name;
string public description;
address payable public author;
string public state = "Opened";
@carloscarvallo
carloscarvallo / CrowdFunding.sol
Created December 22, 2021 22:50
Crowd funding smart contract example with optimized variables to minimize Gas
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
contract CrowdFunding {
string public id;
string public name;
string public description;
address payable public author;
string public state = 'Opened';
@carloscarvallo
carloscarvallo / Reto1.sol
Created December 22, 2021 22:26
Smart contract with basic fund functions
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.9.0;
contract Crowdfunding {
uint public idNumber;
bool public funded = false;
address payable public wallet;
string public projectName;

Keybase proof

I hereby claim:

  • I am carloscarvallo on github.
  • I am carlosdim (https://keybase.io/carlosdim) on keybase.
  • I have a public key ASD4L1ganhZ35ycpZn8WFJ7BT7RC92qwjzH0f-96-AIiugo

To claim this, I am signing this object:

This file has been truncated, but you can view the full file.
/Users/username/CoenraadS.bracket-pair-colorizer-2-unresponsive.cpuprofile.txt
{
"nodes": [
{
"id": 1,
"callFrame": {
"functionName": "(root)",
"scriptId": "0",
"url": "",
@carloscarvallo
carloscarvallo / toSnakeCase.js
Last active February 21, 2018 17:31
Recursive JS script example using lodash 4.x to transform all camel case occurrences to snake case
/*
* Recursive script example using lodash 4.x to transform all camel case occurrences to snake case
* carloscarvallo87@gmail.com
*/
//====================================================================================================================
// script
//====================================================================================================================
var regex = /([a-z])([A-Z])/g
(define (square x) (* x x))
(define (sum-of-squares x y)
(+ (square x) (square y)))
(sum-of-squares 3 4)
(define pi 3.14159)
(define radius 10)
(* pi (* radius radius))
@carloscarvallo
carloscarvallo / deb-package-generator.sh
Created December 15, 2017 20:08
initially was for the tekopuru framework installation on debian/ubuntu systems
#!/bin/bash
TEKOPURU_HOME=/opt/tekopuru
TEKOPURU_DEB=/var/packages
TEKOPURU_TMP=/tmp/tekopuru-packages
if [ $# -ne 1 ]; then
echo "Uso: $0 <nombre-del-paquete>"
echo "Ejemplo: $0 tekopuru-eclipse-3.5"
echo