Skip to content

Instantly share code, notes, and snippets.

View Blazing-Mike's full-sized avatar
👷
Focusing

Michael Blazing-Mike

👷
Focusing
  • Earth C-137
View GitHub Profile
@Blazing-Mike
Blazing-Mike / loop-over-obj.ts
Created December 4, 2022 23:52
Loop over JSON object with angular ngfor
<ng-container *ngFor="let item of APIresponse | keyvalue: indexOrderAsc">
{{item.key.replaceAll('_', ' ') | titlecase}}:{{item.value}}
</ng-container>
function constructEndpoint(lnRequest) {
if (lnRequest.includes("@")) {
return DECODE_LN_ADDRESS;
}
if (lnRequest.startsWith("lnurl") && lnRequest.includes("lnurl")) {
return DECODE_LNURL;
}
if (lnRequest.startsWith("ln")) {
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
// https://vitejs.dev/config/
export default defineConfig({
server: {
proxy: {
"/api": {
target: "http://localhost:3001",
changeOrigin: true,
from bitcoinlib.wallets import Wallet
from bitcoinlib.mnemonic import *
passphrase = Mnemonic().generate()
print(passphrase)
w = Wallet.create("MyFirstWallet", witness_type='segwit', keys=passphrase, network='bitcoin')
WalletKeys = (w.get_keys(number_of_keys=10))
for k in WalletKeys:
def setup_network(self):
"""Setup the test network topology"""
def run_test(self):
"""Main test logic"""
self.log.info("Starting test!")
"""Let the user know the test has started"""
self.sync_all(self.nodes)
@Blazing-Mike
Blazing-Mike / counter.jsx
Created July 19, 2022 13:53
Implemented counter in react class
class Counter extends React.Component {
constructor(props) {
super(props);
this.state = {
count: 0
};
this.decrement = this.decrement.bind(this);
this.increment = this.increment.bind(this);
this.reset = this.reset.bind(this);
import React, { useState } from 'react';
import ReactDOM from 'react-dom';
const style = {
table: {
borderCollapse: 'collapse'
},
tableCell: {
border: '1px solid gray',
margin: 0,
@Blazing-Mike
Blazing-Mike / counter.js
Created June 17, 2022 19:48
a simple counter in react
import React, { useState } from 'react';
import ReactDOM from 'react-dom';
function Counter() {
const [count, setCount] = useState(0);
function increment(){
setCount(count + 1)
}
return (
@Blazing-Mike
Blazing-Mike / destructuring(react).js
Created June 6, 2022 09:58
destructuring in react class component
class Greeter extends React.Component {
render() {
const {first, last} = this.props;
return <h1>Hello, {first} {last}</h1>;
}
}
ReactDOM.createRoot(document.getElementById("root")).render(
<Greeter first="Srini" last="Kata" />
);
@Blazing-Mike
Blazing-Mike / database-backed__web-app.md
Created May 19, 2022 19:41
Steps for getting a database-backed web application up and running
  1. Create a database Using createdb in Postgres.

  2. Establish a connection to the database We can connect to a Postgres server from a Python web server using pyscopg2 with psycopg2.connect().

  3. Define and create your data schema Execute CREATE TABLE commands to create the tables and define the schema (attributes, data types, etc) that will define what data gets housed for our web app.

  4. Seed the database with initial data