Skip to content

Instantly share code, notes, and snippets.

View varunon9's full-sized avatar

Varun kumar varunon9

View GitHub Profile
@varunon9
varunon9 / get-leads-meta-marketing-api.md
Created July 18, 2024 14:13
Get all leads of an instant form using Meta marketing API. We at https://groweasy.ai use this approach to download all leads for our clients

Get all leads belonging to an instant form-

curl --location 'https://graph.facebook.com/v18.0/<FORM_ID>/leads?limit=500&access_token=<LONG_LIVED_ACESS_TOKEN>'
  1. Replace <FORM_ID> with form id, e.g. 1260551454918979
  2. Replace <LONG_LIVED_ACESS_TOKEN> with your access token
@varunon9
varunon9 / meta-marketing-api-audience-targeting-list.json
Created January 15, 2024 18:38
A subset of the audience list that we use at GrowEasy (groweasy.ai) for detailed targeting. This list has been prepared using Meta marketing APIs, and we use it to optimize our lead generation campaigns on Facebook & Instagram.
{
"1":{
"id":"1",
"name":"In high school",
"type":"education_statuses",
"key":"Demographics > Education > Education level > In high school"
},
"2":{
"id":"2",
"name":"In college",
@varunon9
varunon9 / chat-categories-count.json
Created May 12, 2023 19:52
Insight into chat messages between humans and GPT-3.5-turbo bot. Data has been collected from "Pocket AI" android app - https://play.google.com/store/apps/details?id=me.varunon9.pocket_ai
{
"task_oriented": 1432,
"informational": 1254,
"social": 1006,
"personal_advice_and_self_improvement": 816,
"philosophy_and_morality": 479,
"business_and_finance": 424,
"language_and_communication": 295,
"news_and_current_events": 235,
"technical": 63,
@varunon9
varunon9 / AlwaysRunningAndroidService.md
Last active October 16, 2024 13:19
How to create an always running service in Android

Full Source Code: https://github.com/varunon9/DynamicWallpaper/tree/always_running_service

Steps-

  1. Create a Foreground Service (MyService.java)
  2. Create a Manifest registered Broadcast Receiver (MyReceiver.java) which will start your Foreground Service
  3. In onDestroy lifecycle of MyService, send a broadcast intent to MyReceiver
  4. Launch the MyService on app start from MainActivity (see step 8)
  5. With above 4 steps, MyService will always get re-started when killed as long as onDestroy of Service gets called
  6. onDestroy method of Service is not always guaranteed to be called and hence it might not get started again
@varunon9
varunon9 / CalendarDayComponent.js
Created March 19, 2019 17:02
Sample Calendar Day and Header components for react-native-toggle-calendar
import React from 'react';
import { View, Text, StyleSheet, TouchableOpacity, Image } from 'react-native';
import PropTypes from 'prop-types';
const weekDaysNames = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
class CalendarDayComponent extends React.PureComponent {
constructor(props) {
super(props);
this.onDayPress = this.onDayPress.bind(this);
@varunon9
varunon9 / CalendarDayComponent.js
Created February 24, 2019 19:41
react-native-toggle-calendar- customized calendar built on top of react-native-calendars to support horizontal and grid calendar view
import React from 'react';
import { View, Text, StyleSheet, TouchableOpacity } from 'react-native';
import PropTypes from 'prop-types';
const weekDaysNames = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
class CalendarDayComponent extends React.Component {
constructor(props) {
super(props);
this.onDayPress = this.onDayPress.bind(this);
@varunon9
varunon9 / user-service.js
Created May 26, 2018 18:00
A service object to interact with MySql database using sequelize module.
const env = process.env.NODE_ENV || 'development';
const config = require('../config/config.json')[env];
const validationService = require('./validationService');
const models = require('../models');
const bcrypt = require('bcrypt');
module.exports = {
@varunon9
varunon9 / verify-token.js
Created May 26, 2018 17:52
Security middleware for authentication using jsonwebtoken. This gist demonstrate its usage in graphql-express server
const jwt = require('jsonwebtoken'); // used to create, sign, and verify tokens
const env = process.env.NODE_ENV || 'development';
const config = require('../config/config.json')[env];
module.exports = {
verifyToken: function(req, res, next) {
// get token from cookies
@varunon9
varunon9 / graphql-query-client-side.js
Created May 26, 2018 17:41
Querying to graphql server from browser using JQuery Ajax
var globals = {}; // application wide global variable
globals.constants = {
}
globals.showToastMessage = function(heading, message, icon) {
$.toast({
heading: heading,
text: message,
showHideTransition: 'slide',
@varunon9
varunon9 / schema.js
Created May 26, 2018 17:36
A simple graphql schema using graphql-tools
/**
* Created by: Varun kumar
* Date: 23 May, 2018
*/
const { makeExecutableSchema } = require('graphql-tools');
const utilityService = require('../services/utilityService');
const userService = require('../services/userService');