Skip to content

Instantly share code, notes, and snippets.

View WisaniShilumani's full-sized avatar
☄️
A quasar shining through the endless night

Wisani Shilumani WisaniShilumani

☄️
A quasar shining through the endless night
View GitHub Profile
@WisaniShilumani
WisaniShilumani / clipped-area-chart-example.tsx
Created September 27, 2022 13:02
Example of clipped area chart
import React from 'react'
import { StyleSheet, View } from 'react-native'
import { AreaChart, XAxis, YAxis } from 'react-native-svg-charts'
import { Defs, ClipPath, Rect } from 'react-native-svg'
export interface ITimeValueChartDatapoint {
value: number
date: Date
}
import { PRIMARY, PRIMARY_LIGHT, IRON_GREY } from '@styles/variables/colors'
import React, { useEffect, useRef, useState } from 'react'
import styled from 'styled-components'
const Slider = styled.div`
position: relative;
margin: 16px auto;
width: calc(100% - 12px);
height: 8px;
background: ${PRIMARY_LIGHT};
@WisaniShilumani
WisaniShilumani / countdown_to_2PM.js
Last active June 22, 2020 20:50
Countdown to 1400
const next2PM = new Date();
const offsetHours = next2PM.getTimezoneOffset() / 60;
console.log(`current hours at 0 offset (UTC) = ${next2PM.getHours() + offsetHours}h`);
next2PM.setHours(14 + offsetHours, 0, 0, 0); // UTC
if (new Date() >= next2PM) next2PM.setDate(next2PM.getDate() + 1); // doesn't work for the 30/31st (write a func to calculate the next day)
// Update the count down every 1 second
const x = setInterval(function () {
const now = new Date();
const difference = next2PM.getTime() - now.getTime();
const hours = Math.floor((difference % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); // add/remove hours based on timezone
@WisaniShilumani
WisaniShilumani / add-from-search.js
Last active May 18, 2020 20:00
Add from search
const speed = 500;
const connectButtons = document.querySelectorAll(
'.search-result__actions button[data-control-name="srp_profile_actions"]'
);
// ==================== INSTRUCTIONS ========================= //
// =========================================================== //
// 1. Go to LinkedIn Search
// 2. Search for People in an industry e.g. CEO
@WisaniShilumani
WisaniShilumani / scrape-property-24.js
Last active October 5, 2019 18:18
Scrapes a single property 24 page and sends it to an endpoint
const scrape = () => {
const showEmail = document.getElementById('P24_ToggleAgentEmailLink')
const showNumber = document.getElementById('P24_ToggleAgentNumbersLink')
const readMore = document.querySelector('a[title="Read More"]');
let nextClicks = 0
let nextClickInterval = null
const showEmailAndThenShowNumber = () => {
if (showEmail) showEmail.click()
setTimeout(showNumberAndThenReadMore, 3000)
}
const likeAll = () => {
const likes = document.querySelectorAll('.glyphsSpriteHeart__outline__24__grey_9')
console.log(`I'm going to like ${likes.length} posts`)
likes.forEach(element => {
element.click()
})
}
var scroller = function(by) {
window.scrollBy(0, by)
const loveAll = () => {
document.querySelectorAll('div[aria-label="Comment"] > div > div > div > ul > li > span a').forEach(element => {
if (element.innerText === 'Like') {
element.addEventListener('mouseover', function() {
console.log('Event triggered');
});
const event = new MouseEvent('mouseover', {
'view': window,
'bubbles': true,
@WisaniShilumani
WisaniShilumani / package.json
Last active February 25, 2019 10:27
Deploy Could Formation Package.json
{
"name": "my-sam-package",
"version": "1.0.0",
"description": "My amazing sam package",
"main": "src/index.js",
"repository": "https://github.com/my-awesome-org/my-sam-package",
"author": "Me",
"license": "MIT",
"private": true,
"scripts": {
@WisaniShilumani
WisaniShilumani / deploy-multiple.sh
Created February 25, 2019 10:14
Deploy cloudformation to multiple regions
NAME=my-sam-package
S3_BUCKET=my-sam-package
RESOURCES=services
ARCHIVE_NAME=resources.zip
TEMPLATE_FILE=sam.yaml
OUTPUT_TEMPLATE_FILE=sam-output.yaml
ENVIRONMENT=production
AWS_PROFILE=default
REGIONS=( "us-east-1" "us-east-2" "us-west-1" "us-west-2")
@WisaniShilumani
WisaniShilumani / deploy.sh
Last active February 25, 2019 10:15
Cloudformation Deploy
NAME=my-sam-package
S3_BUCKET=my-sam-package
RESOURCES=services
ARCHIVE_NAME=resources.zip
TEMPLATE_FILE=sam.yaml
OUTPUT_TEMPLATE_FILE=sam-output.yaml
ENVIRONMENT=production
AWS_PROFILE=default
REGION=us-east-1