This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use client" | |
import * as React from "react" | |
import { buttonVariants } from "@/components/ui/button" | |
import { ScrollArea } from "@/components/ui/scroll-area" | |
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select" | |
import { cn } from "@/lib/utils" | |
import { ChevronLeft, ChevronRight } from "lucide-react" | |
import { DayPicker, DropdownProps } from "react-day-picker" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const myMemoize = (func) => { | |
const cache = {}; | |
return (...args) => { | |
const argCache = JSON.stringify(args); | |
if (!(argCache in cache)) { | |
cache[argCache] = func(...args) | |
} | |
return cache[argCache]; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Infinite add using currying | |
const add = (a) => (b) => { | |
if (b) return add(a + b) | |
return a | |
} | |
console.log(add(1)(2)(3)()); // 6 | |
console.log(add(5)(20)(10)(30)()); // 65 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// DS Stack uisng JS Clousers | |
const buildStack = () => { | |
let items = [] | |
const push = (item) => items = [...items, item]; | |
const pop = () => items = items.slice(1); | |
const peek = () => items[0]; | |
const isEmpty = () => !items.length; | |
const size = () => items.length; | |
const list = () => items; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// JSON DB Query engine using JS currying | |
// Ref: https://www.freecodecamp.org/news/playing-around-with-closures-currying-and-cool-abstractions/ | |
const db = { | |
"friends": [ | |
{ | |
"id": 1, | |
"name": "Nitin", | |
"age": 35, | |
"email": "nitin@meswapnilwagh.com" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @file | |
* Amazon Elastic Load Balancer Settings. | |
* | |
* Force server to use https:// path if SSL is handled at load balancer. | |
* | |
* @see http://drupal.org/node/185161#comment-5452038 | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import os | |
import comtypes.client | |
wdFormatPDF = 17 | |
in_file = "path_to_doc_file" | |
out_file = "path_to_save_pdf" | |
word = comtypes.client.CreateObject('Word.Application') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import os | |
import win32com.client | |
wdFormatPDF = 17 | |
in_file = "path_to_doc_file" | |
out_file = "path_to_save_pdf" | |
word = win32com.client.Dispatch('Word.Application') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Automated AMI and Snapshot Deletion | |
# | |
# @author Robert Kozora <bobby@kozora.me> | |
# | |
# This script will search for all instances having a tag with "Backup" or "backup" | |
# on it. As soon as we have the instances list, we loop through each instance | |
# and reference the AMIs of that instance. We check that the latest daily backup | |
# succeeded then we store every image that's reached its DeleteOn tag's date for | |
# deletion. We then loop through the AMIs, deregister them and remove all the | |
# snapshots associated with that AMI. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ~/.bash_profile | |
[[ -s ~/.bashrc ]] && source ~/.bashrc | |
export CLICOLOR=1 | |
export LSCOLORS=GxFxCxDxBxegedabagaced | |
alias subl='/Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl' | |
alias ls='ls -GFh' | |
alias ll='ls -l' |
NewerOlder