Skip to content

Instantly share code, notes, and snippets.

View Tridence's full-sized avatar
🤯
./test

Brian Wanjala Tridence

🤯
./test
View GitHub Profile
@lornawanjiru
lornawanjiru / Data-structure-and-algorithm.js
Last active April 18, 2022 17:01
Data structure and algorithm notes. I have tackled a number of questions and realized i would forget some algorithms since I don't repeat the questions as much. I made this gist to help me go through the question intensively.
##Longest Substring with At Most K Distinct Characters
var lengthOfLongestSubstringKDistinct = function(s, k) {
//incase the length of the string is the same or less than the distict number then return the length of the string.
if(k >= s.length ){
return s.length;
}
//define an empty hash map variable.
let hmap = {}
let max = 0;
//iterating through the string.

Python Boot Camp : Python Basics & Concepts.

Python is an interpreted, high-level language created by Guido van Rossum and released in 1991. It is dynamically typed and garbage collected.

Python programs have the extension .py and can be run from the command line by typing python file_name.py.

Probably its most noticeable characteristic is its use of significant white space to delimit code blocks, instead of the more popular {} symbols.

End-of-line semicolons (;) are optional and usually not used in Python.

React File Structure

react-todo-app
    ├── node_modules
    ├── public
    │    ├── favicon.ico
    │    ├── index.html
    │    ├── logo192.png
    │    ├── logo512.png
 │ ├── manifest.json

Styling Reactjs App

There are several ways we can style our ReactElements and Compoents but we will only cover the inline CSS, the CSS stylesheet and the CSS Modules.

Some of the other strategies include – CSS-in-JS (e.g styled components, Emotion, JSS), Sass & SCSS, Less, Utility-First-CSS (e.g Tailwind CSS).

CSS Stylesheet

This is quite basic and straight forward method as you should be familiar with it while working with HTML file.

You start by creating a new file called App.css in the src folder.

@SalahAdDin
SalahAdDin / commands.md
Created January 21, 2019 14:48
Repairing Arch/Manjaro Grub

If we have access to the grub rescue, we can do the next steps:

grub rescue > ls
(hd0)... (hd0,gpt8)...
grub rescue > ls (hd2,gpt8) # try to recognize which partition is this
grub rescue > ls (hd2,gpt6) # let's assume this is the linux partition
grub rescue > set root=(hd2,gpt6)
grub rescue > set prefix=(hd2,gpt6)/boot/grub # or wherever grub is installed
grub rescue > insmod normal # if this produced an error, reset root and prefix to something else ..
grub rescue > normal
@gbraad
gbraad / README.md
Last active May 12, 2024 09:13
Buy Me a Coffee

Buy Me a Coffee

Using inlined HTML

Buy Me A Coffee

<a href="https://www.buymeacoffee.com/gbraad" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" alt="Buy Me A Coffee" style="height: 41px !important;width: 174px !important;box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;" ></a>
@SMacEwan
SMacEwan / gist:3746653
Created September 18, 2012 23:13
PHP Database connection template
<?php
//Replace ALL the things!
$hostname = 'localhost';
$database = 'testdb';
$username = 'root';
$password = 'root';
$dbh = new PDO('mysql:host=' . $hostname . ';dbname=' . $database, $username, $password);
@jc245410
jc245410 / interestcalc
Created April 17, 2012 04:18
Simple or Compound interest calculator
% Calculate Compound or simple interest
%
% _____________________
% input data and ---> | calculate interest | -----> output interst
% type of interest |_____________________|
%
%
clear
clc
%simple interest