Skip to content

Instantly share code, notes, and snippets.

👑
ruling the world

Jatto Abdulqahhar jattoabdul

👑
ruling the world
Block or report user

Report or block jattoabdul

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jattoabdul
jattoabdul / subscriptions.html.erb
Created Nov 1, 2019
Write the code for app/views/admins/subscriptions.html.erb to display in a particular format while using bootstrap css framework in rails views
View subscriptions.html.erb
<div class="container-fluid">
<% @subscriptions.each do |subscription| %>
<div class="row">
<div class="col-md-8 col-sm-12 col-xs-12">
<%= mail_to "subscription.email" %>
</div>
<div class="col-md-4 col-sm-12 col-xs-12">
<span><%= subscription.plan&.name %></span>
</div>
</div>
@jattoabdul
jattoabdul / noteable.rb
Last active May 13, 2019
Using Active Support Concerns
View noteable.rb
require 'activesupport/concern'
module Noteable
extend ActiveSupport::Concern
included do
has_many :notes, as: :noteable
end
def note_taking_action
@jattoabdul
jattoabdul / Ruby Rubocop Style guide
Created Oct 7, 2018
This should be in the .rubocop.yml file in the root of your rails app after installing and configuring rubocop
View Ruby Rubocop Style guide
AllCops:
Exclude:
- "vendor/**/*"
- "db/**/*"
- "tmp/**/*"
- "bin/**/*"
- "log/**/*"
- "config/**/*"
- "app/assets/**/*"
- "Rakefile"
View Javascript Style Guide.md
{
  "root": true,
  "extends": "airbnb-base",
  "env": {
    "node": true,
    "es6": true,
    "mocha": true
  },
  "rules": {
View remove__num_suffix_in_action.py
def __num_suffix(self, check_in_date):
"""
Strip the date suffix and return the date
Before comparing the date
"""
date_value = str(check_in_date).split(' ')
day_value = date_value[0][:-2]
date_value[0] = day_value
return ' '.join(date_value)
View __convert_to_date_in_actions.py
def __convert_to_date(self, date_string):
today = date.today()
if date_string == 'today':
return today
elif date_string == 'yesterday':
return today - timedelta(days=1)
elif date_string == 'tomorrow':
return today + timedelta(days=1)
else:
return today
View my_tasks_in_actions.py
def my_tasks(self):
email = self.user_info['user']['profile']['email']
recipient = self.user_info['user']['id']
task_cells = list(filter(lambda x: x['Email Address'] == email, self.sheet))
for index, row in enumerate(task_cells):
text_detail = (
'*Task #{} for {}:* \n\n'
'*Hey {},* Today is the check-in day for your writeup titled\n'
'`{}`.\n\n'
'Whats the status of the article?\n'
View help_method_in_actions.py
def help(self):
"""
Return the Available commands in the system and their usage format
"""
return {
'text': 'Available Commands: \n `/ranti my-task e.g. /ranti my-task` \n To get task assigned to you.\n'
' \n `/ranti show-task [date]{dth-month-year} e.g. /ranti show-task 5th-june-2018` \n Show all tasks for a particular date \n'
'\n `/ranti show-task [today] e.g. /ranti show-task today` \n Show all tasks for today \n'
'\n `/ranti show-task [tomorrow] e.g. /ranti show-task tomorrow` \n Show all tasks for tomorrow \n'
'\n `/ranti help` \n This help information \n \n Ranti Ver: 1.0'}
View show_tasks_in_actions.py
def show_tasks(self, date=None):
if date in ['today', 'tomorrow', 'yesterday']:
day_date_param = self.__convert_to_date(date)
task_cells = list(filter(lambda x: datetime.strptime(self.__num_suffix(x['Next Check-In']), '%d %B %Y').date() == day_date_param, self.sheet))
if task_cells:
self.__perform_send_action(task_cells)
else:
return {'text': 'No task assigned to be checked in {}, try another date'.format(date)}
else:
date_param = date.replace('-', ' ')
View __perform_send_action_in_actions.py
def __perform_send_action(self, task_cells):
recipient = self.user_info['user']['id']
for index, row in enumerate(task_cells):
text_detail = (
'*Task #{} for {}:* \n\n'
'*Hey {},* Today is the check-in day for your writeup titled\n'
'`{}`.\n\n'
'Whats the status of the article?\n'
'PS: Please reply to this thread, the managers will review and reply you ASAP').format(
str(index + 1), row['Next Check-In'], row['Name'],
You can’t perform that action at this time.