Skip to content

Instantly share code, notes, and snippets.

View callezenwaka's full-sized avatar

Callis callezenwaka

View GitHub Profile
@callezenwaka
callezenwaka / check.py
Last active November 9, 2022 07:52
How To Check If Python Is 32 Or 64-bit
# First import struct module.
import struct
# Return 64 means 64-bit version, return 32 means 32-bit version.
version = struct.calcsize("P") * 8
print(version)
@callezenwaka
callezenwaka / index.js
Created September 7, 2022 16:20
React two-way data binding
import logo from "./logo.svg";
import "./App.css";
import { useState } from "react";
function App() {
const [food, setFood] = useState("dumpling");
return (
<div className="App">
<input
@callezenwaka
callezenwaka / Array.sol
Last active February 19, 2022 00:45
Handle array in javascript
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
/**
* @title Storage
* @dev Store & retrieve value in a variable
*/
contract Array {
@callezenwaka
callezenwaka / index.html
Created January 19, 2022 09:05
Add space in html file
<!DOCTYPE html>
<html>
<head>
<title>
How to insert spaces/tabs in text using HTML/CSS?
</title>
</head>
<body>
<h1 style="color: green">GeeksforGeeks</h1>
<b>How to insert spaces/tabs in text using HTML/CSS?</b>
@callezenwaka
callezenwaka / Event.vue
Created January 19, 2022 07:24
Handle events in Vue 3 with Typescript
<template>
<div class="body--wrapper" :class="{ active: !slide && !width }">
<Header"></Header>
<div class="container">
<router-view :key="$route.path"/>
</div>
</div>
</template>
<script lang="ts">
Setup a POST => request;
Replace firebase api key in the url => "https://www.googleapis.com/identitytoolkit/v3/relyingparty/verifyPassword?key={FIREBASE_API_KEY}"
Pass the following params in the body of the request
{
"email": "<email>",
"password": "<password>",
"returnSecureToken": true
}
'use strict';
// Import packages
import admin from 'firebase-admin';
const FieldValue = admin.firestore.FieldValue;
// Add credential service account details
import serviceAccount from ".path-to-file.json";
// Initialize firebase admin sdk config
@callezenwaka
callezenwaka / Padding numbers in JavaScript
Last active July 9, 2021 05:09
Number Padding In JavaScript
// Define new date, result
let d = new Date(), result;
// Set new date
d.setDate(d.getDate() + 20);
// Return result
result = ('0' + d.getDate()).slice(-2) + '/' + ('0' + (d.getMonth()+1)).slice(-2) + '/' + d.getFullYear();
Explanation:
.slice(-2) returns the last 2 characters of the string.
Refer to doc here <a href="https://firebase.google.com/docs/functions/config-env">Config Env. Setup</a>
# Set environment configuration for your project
```
firebase functions:config:set someservice.key="THE API KEY" someservice.id="THE CLIENT ID"
```
# Retrieve current environment configuration
```
firebase functions:config:get
@callezenwaka
callezenwaka / Centered div
Last active July 12, 2021 20:51
How to center div with position absolute
<!DOCTYPE html>
<html>
<head>
<style>
.loader {
background-color: #000;
position: absolute;
height: 4rem;
width: 4rem;
left: 50%;