Skip to content

Instantly share code, notes, and snippets.

View lilpolymath's full-sized avatar
:octocat:
Exploring

Favour lilpolymath

:octocat:
Exploring
View GitHub Profile
image: reactnativecommunity/react-native-android
pipelines:
custom:
no-test:
- step:
name: Build without Test
caches:
- node
- gradle
@lilpolymath
lilpolymath / grid-gen.scss
Created January 15, 2021 21:47
Dynamic Grid generator
// Chnage these as per your requirement
$columns: 1, 2, 3;
// these are just placeholders for reference, change the actual values in mixin: grid-gen
// $breakpoints: "sm", "md", "lg", "xl";
// $breakpoint-sizes: 576px, 768px, 992px, 1200px;
// creates CSS grid template columns with $columns
@mixin mk-columns($breakpoint) {
@each $column in $columns {
@lilpolymath
lilpolymath / styles.scss
Created November 19, 2020 20:05
Dynamic Spacing with margin and padding.
@for $i from 0 through 15 {
.mt-#{$i} {
margin-top: #{$i}rem !important;
}
.mb-#{$i} {
margin-bottom: #{$i}rem !important;
}
.ml-#{$i} {
import { Component } from 'react'
import ReactDOM from 'react-dom'
export default class Observer extends Component {
isIntersecting = false
getCurrentScrollPos() {
const supportPageOffset = window.pageXOffset !== undefined,
isCSS1Compat = (document.compatMode || '') === 'CSS1Compat'
return supportPageOffset
import React, { useState, useEffect } from "react";
export default function App() {
const [windowWidth, setWindowWidth] = useState(window.innerWidth);
const resizeHandler = () => {
setWindowWidth(window.innerWidth);
};
useEffect(() => {
window.addEventListener("resize", resizeHandler);
@lilpolymath
lilpolymath / Module.jsx
Last active July 29, 2020 12:23
Sample on how CSS Modules works.
import * as React from 'react';
import styles from './style.module.css';
export default function Container({ children, as = 'div', ...props }) {
const Component = as;
const style = styles.container + ' ' + props.styles;
return (
@lilpolymath
lilpolymath / admin.css
Created July 15, 2020 05:06
Mobile responsive workaround for Netlify CMS.
@media (max-width: 799px) {
.css-1gj57a0-SidebarContainer-card {
position: static;
width: 100%;
margin-bottom: 30px;
}
.css-v758ki-AppMainContainer, .css-12b66la-AppHeaderContent {
min-width: 0;
}
.css-104dqk8-AppHeaderButton-button-buttonActive-buttonActive-buttonActive-buttonActive-AppHeaderButton, .css-12yqrwa-AppHeaderNavLink-AppHeaderButton-button-buttonActive-buttonActive-buttonActive-buttonActive-AppHeaderButton {
# Little setback is that how input would be given
# Gets input separate by spaces
arr = [int(x) for x in input().split()]
# this part gets the min and max incase
# not properly formatted from line 3
max = max(arr)
min = min(arr)
# Populating the array
@lilpolymath
lilpolymath / stacks.cpp
Created May 5, 2020 22:36
Stacks and Queues with C++
#include <iostream>
#include <iomanip>
#include <string>
// Implementing a stack using an array
// THe initial size of the array
#define st_len 5
using namespace std;
@lilpolymath
lilpolymath / solution.py
Created April 18, 2020 23:27
Perfect Number
def solve(number):
sum = 0
middle = int(number/2) + 1
for i in range(1,middle):
if number%i == 0:
sum += i
if sum == number:
return sum