Skip to content

Instantly share code, notes, and snippets.

View yedhink's full-sized avatar
✍️
working and learning.

Yedhin Kizhakkethara yedhink

✍️
working and learning.
View GitHub Profile
@yedhink
yedhink / assignment1.py
Created March 21, 2019 15:35
NLP elective assignments
from nltk.corpus import brown
from nltk.util import ngrams
from collections import defaultdict
tagged_words = brown.tagged_words()
# question 1
def countTags(tag):
count = 0
for x in tagged_words:
@yedhink
yedhink / assignment2.py
Created March 25, 2019 07:13
nlp assignment 2
import nltk
from nltk import PCFG, CFG
from nltk.draw.tree import draw_trees
# out cfg
cfg_grammar = CFG.fromstring("""
S -> NP VP
NP -> ART N | N N | N | NP PP
VP -> V | V NP | V NP PP
PP -> P NP
@yedhink
yedhink / rails-mocking.md
Created October 3, 2022 06:20
Mocking 3rd party APIs

Let's say that in our application, we need to fetch events from our Google Calendar. So if we want to write test cases verifying this logic, then we ought to mock the API calls to Google APIs.

We can use Webmock to mock these requests. But let's see how we can do this in a DRY fashion.

First let's start by creating a support file at test/support/google_calendar_api_support.rb and add the following content to it:

# frozen_string_literal: true

module GoogleCalendarApiSupport
@yedhink
yedhink / setup-neetoreview.md
Last active November 8, 2022 08:43 — forked from ghousemohamed/instructions.md
How to Deploy Rails Application using neetoReview

1. Create a file named Procfile in the root directory with the following content:

web:  bundle exec puma -C config/puma.rb
worker: bundle exec sidekiq -C config/sidekiq.yml
release: bundle exec rake db:migrate populate_with_sample_data

Please make sure you have a rake task available in the project called populate_with_sample_data. This rake task does not necessarily need to have any associated code in it. It can be a blank rake task, or you can choose to populate it with your own custom logic your app might require, like say setting up a default user oliver@example.com. Example: https://github.com/bigbinary/wheel/blob/main/lib/tasks/setup.rake#L8-L12