Skip to content

Instantly share code, notes, and snippets.

View sachitsac's full-sized avatar
💭
Learning react and AWS CDK

Sachit sachitsac

💭
Learning react and AWS CDK
View GitHub Profile
@sachitsac
sachitsac / zod-external-api-example-no-validation.ts
Created January 11, 2023 11:13
How to add runtime type safety using zod when using external api's
interface User {
id: number;
name: string;
email: string;
address?: string;
}
interface GetUserByIdParams {
id: User["id"];
filter: { [k in keyof User]: User[k] };
export const mockedCorrectUser = {
name: "abc",
uuid: "b3963682-08f1-4946-b832-3b7fe4d45f6c",
email: "me@awesome.com",
verified: true,
};
export const invalidUser = {
name: "abc",
uuid: "abc",
{
kpireferences: {
prefixes: {
http: //api.clearsight.co/ontology/Wolverine: "O0",
http: //apidev.clearsight.co/data/tellmeharrysachit: "D0"
},
access: [
],
data: {
@sachitsac
sachitsac / gist:49d42d5a6ef7d158d1a0
Last active August 29, 2015 14:08
GIT Change log generator for a provided period
#!/bin/bash
START=$1
END=$2
if [[ "$#" -ne 2 ]]; then
echo -e "Proved a start and end time using this fromat: YYYY-MM-D";
exit;
fi
@sachitsac
sachitsac / XHProf
Created November 29, 2013 13:31
Install Xhprof on ubuntu 12.04 and enable the web interface using an alias /profiling
#!/bin/bash
sudo apt-get install php-pear
sudo pear upgrade pear
sudo pecl install xhprof-beta
sudo apt-get install graphviz
sudo cp /etc/php5/apache2/php.ini /etc/php5/apache2/php.ini_original
sudo cp /etc/php5/apache2/php.ini /tmp
@sachitsac
sachitsac / GitPullPush
Created November 28, 2013 09:00
Git Pull and Push in one line
#!/bin/bash
if [ $# -ne 3 ]
then
echo -e "Usage gitpush [remote_branch] [branch_name] [commit_message]"
echo -e "eg: gitpush origin master 'Some commit message'"
exit
fi
git add .