Skip to content

Instantly share code, notes, and snippets.

@abhinaykumar
abhinaykumar / facebook_leads.md
Last active August 12, 2024 11:12 — forked from machouz/facebook_leads.md
Receive Facebook Ad Lead With Your Own Webhook (without Zapier)

Step-by-step guide: Get your FB Lead on your Webhook

This gist was created in 2023 and is inspired from tixastronauta and eladnava tutorial.

The Facebook API changes frequently. As a result, this guide might not be accurate.

1 - Create an App

Sign up for Facebook Developer access if you haven't already, from the same account as your Facebook Ads advertising account.

@abhinaykumar
abhinaykumar / scrapper.ruby
Created August 25, 2023 07:34
Scrape page with Nokigiri
# https://soravjain.com/digital-marketing-agencies-india/
data = []
email= nil
address=nil
phone=nil
website=nil
services=nil
brands=nil
doc.css("p").each do |x|
if x.content.start_with?("Services")
@abhinaykumar
abhinaykumar / how-to-copy-aws-rds-to-local.md
Created September 24, 2022 03:58 — forked from syafiqfaiz/how-to-copy-aws-rds-to-local.md
How to copy production database on AWS RDS(postgresql) to local development database.
  1. Change your database RDS instance security group to allow your machine to access it.
    • Add your ip to the security group to acces the instance via Postgres.
  2. Make a copy of the database using pg_dump
    • $ pg_dump -h <public dns> -U <my username> -f <name of dump file .sql> <name of my database>
    • you will be asked for postgressql password.
    • a dump file(.sql) will be created
  3. Restore that dump file to your local database.
    • but you might need to drop the database and create it first
    • $ psql -U <postgresql username> -d <database name> -f <dump file that you want to restore>
  • the database is restored
@abhinaykumar
abhinaykumar / map-fontawesome-icon-with-social-media-url.json
Last active September 5, 2022 03:41
Mapping of fontawesome icons with top social medial url
{
"facebook.com": "<i class='fa-brands fa-facebook-f'></i>",
"twitter.com": "<i class='fa-brands fa-twitter'></i>",
"instagram.com": "<i class='fa-brands fa-instagram'></i>",
"linkedin.com": "<i class='fa-brands fa-linkedin-in'></i>",
"snapchat.com": "<i class='fa-brands fa-snapchat'></i>",
"tumblr.com": "<i class='fa-brands fa-tumblr'></i>",
"pinterest.com": "<i class='fa-brands fa-pinterest-p'></i>",
"reddit.com": "<i class='fa-brands fa-reddit-alien'></i>",
"tiktok.com": "<i class='fa-brands fa-tiktok'></i>",
@abhinaykumar
abhinaykumar / Http.rb
Created June 26, 2022 04:21
Common class to make HTTP requests using Faraday. Parallel POST requests with Faraday and Typhoeus Hydra.
class Http
class << self
def send_request(url, options = {}, verb = :get)
headers = options[:headers]
headers = headers.present? ? default_headers.merge(headers) : default_headers
body = options[:body].presence
body = body.to_json if headers['Content-Type'] == 'application/json'
query = options[:query].presence
payload = verb == :get ? query : body
@abhinaykumar
abhinaykumar / Jest-encountered-an-unexpected-token.md
Created December 13, 2021 09:22
Jest encountered an unexpected token (when importing MD format file)
<!-- ERROR -->
Jest encountered an unexpected token

    Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax.

    Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration.

    By default "node_modules" folder is ignored by transformers.
@abhinaykumar
abhinaykumar / Graphql subscription with ActionCable
Last active May 31, 2021 05:11
Setup Graphql subscription with ActionCable Rails
{ Ref: https://evilmartians.com/chronicles/graphql-on-rails-3-on-the-way-to-perfection }
(Rails - 5, Graphql-ruby - 1.8.x)
# Gemfile
gem 'redis'
@abhinaykumar
abhinaykumar / Deploy monorepo to Heroku
Created November 10, 2020 13:59
Deploy monorepo to Heroku
1. Create Procfile at the root of each frontend and backend folder (with command to start the server)
2. Create Heroku dynos for each (frontend and backend)
```
heroku create -a my-awesome-frontend
heroku create -a my-awesome-backend
```
3. Get the auth token from Heroku by running: `heroku auth:token` #=> HEROKU_API_TOKEN
4. Add remote origin for frontend and backend
```
@abhinaykumar
abhinaykumar / gist:4762e168d5f78fbb46edeec61a4abe65
Created March 12, 2020 08:55 — forked from guisehn/gist:6648c8fdcd1102a22a22
Backup Heroku Postgres database and restore to local database

Grab new backup

Command: heroku pg:backups capture -a [app_name]

Download

Command: curl -o latest.dump `heroku pg:backups public-url -a [app_name]`

Restore backup dump into local db

@abhinaykumar
abhinaykumar / break.py
Created September 25, 2018 06:55 — forked from obfusk/break.py
python equivalent of ruby's binding.pry
import code; code.interact(local=dict(globals(), **locals()))