Skip to content

Instantly share code, notes, and snippets.

View sahilkashyap64's full-sized avatar
🎯
Focusing

Sahil Kashyap sahilkashyap64

🎯
Focusing
View GitHub Profile
@sahilkashyap64
sahilkashyap64 / AddressPicker.js
Created April 30, 2024 07:55
survey react native
import React,{useRef,useEffect} from 'react';
import {View,Text,SafeAreaView,ScrollView} from 'react-native'
import { GooglePlacesAutocomplete } from 'react-native-google-places-autocomplete';
import {GOOGLE_MAPS_AUTOCOMPLETE_API_KEY} from '../../constants'
const apiKey=GOOGLE_MAPS_AUTOCOMPLETE_API_KEY;
import { getReverseCodeLocation } from '../../api/locations';
navigator.geolocation = require('react-native-geolocation-service');
const AddressPicker = ({onSelect,latitude,longitude}) => {
console.log("AddressPicker",{latitude,longitude});
@sahilkashyap64
sahilkashyap64 / pg.sh
Created March 7, 2024 21:38
pg_dump mac command not found
export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/latest/bin
pg_dump
@sahilkashyap64
sahilkashyap64 / insertData.sql
Last active February 29, 2024 21:59
survey to support multiple question type
BEGIN; -- Start of the transaction
-- insert data
-- Dummy Organization
INSERT INTO organizations (id,organization_name) VALUES (1,'Tennis Survey Organization');
-- Dummy Survey Header, assuming organization_id = 1
INSERT INTO survey_headers (id,organization_id, survey_name, instructions) VALUES (1,1, 'Tennis Partner Survey', 'Please complete this survey to find your ideal tennis partner.');
-- Input Types
@sahilkashyap64
sahilkashyap64 / surveyDB.sql
Created February 28, 2024 17:05
survey db based on the thesis
-- https://wwwiti.cs.uni-magdeburg.de/iti_db/publikationen/ps/auto/thesisJohn22.pdf
BEGIN;
-- Drop tables if they already exist to avoid errors
DROP TABLE IF EXISTS Footnote CASCADE;
DROP TABLE IF EXISTS Additional_Answer_Part_Choice CASCADE;
DROP TABLE IF EXISTS Choice_Text CASCADE;
DROP TABLE IF EXISTS Choice_Group CASCADE;
DROP TABLE IF EXISTS Additional_Answer_Part CASCADE;
@sahilkashyap64
sahilkashyap64 / CollectionOptions.js
Last active July 14, 2023 21:02
React native shopify
import React from 'react';
import { normalize, SCREEN_WIDTH } from '../../../../theme/metrics';
import { View, Text, TextInput, ScrollView, Image, SafeAreaView, StyleSheet, TouchableOpacity, Dimensions } from 'react-native';
const pageWidth = Dimensions.get('window').width;
const logo = {
uri: 'https://reactnative.dev/img/tiny_logo.png',
width: 64,
height: 64,
};
@sahilkashyap64
sahilkashyap64 / products.js
Created June 17, 2023 10:33
chaninging middleware nodejs
function prepareForMiddleware(req,res,next,data){
res.return=data;
next();
}
function productDetails(){
// return res.json({ message: 'Product Details', product, similar, variants });
let data = { message: 'Product Details', product, similar, variants };
prepareForMiddleware(req,res,next,data);
@sahilkashyap64
sahilkashyap64 / shopifyOrder.js
Created April 22, 2023 11:10
array of object, nested array of object merged into parent obj
const data = [
{
"id": 5363606323483,
"created_at": "2023-04-19T06:10:09-04:00",
"currency": "USD",
"name": "#1049",
"note_attributes": [
{
"name": "user_email",
@sahilkashyap64
sahilkashyap64 / script.turf-sandbox
Created January 23, 2023 14:21
turf-sandbox snippet
// simply return a valid GeoJSON and it will be rendered on the map
var REGION_CAR_DELIVERY = turf.polygon([[
[ -118.2472203, 34.0805791 ],
[ -118.2458824, 34.0831055 ],
[ -118.2441979, 34.0848758 ],
[ -118.241408, 34.0872652 ],
[ -118.2399476, 34.0900534 ],
[ -118.2407174, 34.0913652 ],
[ -118.2430294, 34.0937757 ],
[ -118.2455076, 34.0964647 ],
@sahilkashyap64
sahilkashyap64 / script.turf-sandbox
Created January 23, 2023 14:21
turf-sandbox snippet
var REGION_CAR_DELIVERY = turf.polygon([[
[ -118.2472203, 34.0805791 ],
[ -118.2458824, 34.0831055 ],
[ -118.2441979, 34.0848758 ],
[ -118.241408, 34.0872652 ],
[ -118.2399476, 34.0900534 ],
[ -118.2407174, 34.0913652 ],
[ -118.2430294, 34.0937757 ],
[ -118.2455076, 34.0964647 ],
[ -118.2473742, 34.098147 ],
@sahilkashyap64
sahilkashyap64 / LoginPage.jsx
Last active May 19, 2022 12:49
Social login(Google,FB) Backend
//react frontend
import { GoogleLogin } from 'react-google-login';
import FacebookLogin from 'react-facebook-login';
class LoginPage extends Component {
constructor(props) {
super(props);
this.state = {
userId: '',
password: '',