Skip to content

Instantly share code, notes, and snippets.

@SoftwareDevPro
SoftwareDevPro / GoBlockChain.go
Created December 30, 2021 01:42
Basic Blockchain with Go
package main
import (
"crypto/sha256"
"encoding/json"
"fmt"
"strconv"
"strings"
"time"
)
@SoftwareDevPro
SoftwareDevPro / blockchain.py
Created December 11, 2021 03:30
Simple Python Blockchain Implementation
from hashlib import sha256
import json
from time import time
class Block:
def __init__(self, timestamp=None, data=None):
self.timestamp = timestamp or time()
self.data = [] if data is None else data
@SoftwareDevPro
SoftwareDevPro / react_hooks_cheatsheet.md
Created February 12, 2021 23:56
React Hooks Cheatsheet

React Hooks Cheatsheet

useState Hook

The useState hook allows us to create state variables in a React function component.

Create State Variables with useState

import { useState } from 'react';
@SoftwareDevPro
SoftwareDevPro / 01_standard_nodejs.js
Last active February 11, 2021 22:00
5 ways to make HTTP Requests in Node.JS
const https = require('https');
https.get('https://jsonplaceholder.typicode.com/posts', response => {
let data = [];
const hdrDate = response.headers
&& response.headers.date
? response.headers.date : 'no response date';
@SoftwareDevPro
SoftwareDevPro / ruby_on_rails_cheatsheet.md
Created February 11, 2021 21:51
Ruby On Rails (RoR) Cheatsheet

Ruby on Rails cheatsheet

Ruby on Rails Keywords

alias defined? FILE not then
and do for or true
BEGIN else if redo undef
@SoftwareDevPro
SoftwareDevPro / javascript_cheatsheet.md
Created January 30, 2021 00:56
Javascript Cheatsheet

Javascript Cheatsheet

Data Types

let age = 28; // Number

let name = "Joe"; // string

let name = { // object
  firstName : "Joe", 
@SoftwareDevPro
SoftwareDevPro / ruby_cheatsheet.md
Created January 26, 2021 22:30
Cheatsheet for Ruby

Ruby Cheatsheet

General Syntax

  • Comments start with a pound character, and go to the end of the line
  • For multi-line comments use "=begin" and "=end"
  • Expressions are finished with a semi-colon, followed by a new line
  • Including a backslash () at the end of a line does not terminate the expression
@SoftwareDevPro
SoftwareDevPro / php_cheatsheet.md
Created January 20, 2021 18:01
PHP Cheatsheet

PHP Cheatsheet

Including PHP in a file

<?php
    // place PHP code here
?>
@SoftwareDevPro
SoftwareDevPro / axios_cheatsheet.md
Created December 27, 2020 06:20
Axios is a promise based HTTP client for the browser and Node

Axios is a promise based HTTP client for the browser and Node. Axios makes it easy to send asynchronous HTTP requests to REST API endpoints and perform CRUD (create,read,update,delete) operations. It can be used in vanilla plain JavaScript or with a library such as Vue or React.

Installing Axios

  • npm: npm install axios
  • pnpm: pnpm install axios
  • bower: bower install axios
@SoftwareDevPro
SoftwareDevPro / curl_tool_usage.md
Created December 24, 2020 23:55
cURL tool usage, tips, and usage as an alternative to Postman

cURL tool usage, tips, and usage as an alternative to Postman

cURL is a transfer tool used to transfer data from or to a server. It supports various internet protocols of transfer, including: DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET and TFTP. Using cURL one can perform useful tricks with cURL like proxy support, user authentication, FTP upload, HTTP post, SSL connections, cookies, file transfer resume, Metalink, and more.

cURL options

--request or -X

--request and -X specify a custom request method you can use when communicating with the HTTP server. The specified request method will be used instead of the method otherwise used (which defaults to GET).