Skip to content

Instantly share code, notes, and snippets.

View kavyasukumar's full-sized avatar
🤔

Kavya Sukumar kavyasukumar

🤔
View GitHub Profile
@kavyasukumar
kavyasukumar / ChromeStarter.sh
Last active November 8, 2021 20:41
Google Chrome Launcher
#!/bin/bash
open -na "Google Chrome" --args --profile-directory="Profile 1"
@kavyasukumar
kavyasukumar / slackthemes.md
Last active February 19, 2019 20:22
Slack themes

My slack themes

Vox

#567076,#6A9CA8,#fdf151,#454745,#6a9ca8,#FFFFFF,#a4cd39,#FDF151

Tronc theme dark

#333333,#FA5D22,#1576f7,#FFFFFF,#FA5D22,#dddddd,#16f4a6,#c90b47

Tronc light

#F8F8FA,#FA5D22,#1576f7,#FFFFFF,#FA5D22,#383F45,#60D156,#DC5960

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Sample 1

Assumptions

The request parameter passed to the method is a standard Rails request object.

1. What does this method do?

This method checks if the request came from a list of known bots. It returns true if the user agent -- the part of request that describes the kind of browser or "agent" that was used to make the request -- contains any of the bot identifier words defined in code. In this case it specifically looks for SEOkicks or Semrush bots.

From the name of the method, I assume that the method is used in context with blocking a request from a bot. I had to look up the specific bots mentioned here. They look like web crawlers that index backlink information.

There are many reasons one would want to block crawlers including preventing unnecessary traffic and spamming on the site, preventing indexing of duplicate content, and prevent scraping data from your site.

[{"date":"2012-12-14","abbrev":"NC","gva_id":0,"killed":27,"schema":1524243700245,"wounded":2,"latitude":41.42,"longitude":-73.278611,"city_or_county":"Sandy Hook","id":"d2a34dfe-a1a8-4cdf-b8e0-85a4e8e3c033","last_modified":1527026826074,"index":0},{"date":"2013-01-01","abbrev":"PA","gva_id":461105,"killed":0,"wounded":4,"latitude":40.3470671,"longitude":-79.8641232,"city_or_county":"Mckeesport","id":"c2e73541-9328-4e83-a389-5e88ee04d1cf","last_modified":1524213131288,"index":1},{"date":"2013-01-01","abbrev":"CA","gva_id":460726,"killed":1,"wounded":3,"latitude":33.9164032,"longitude":-118.3525748,"city_or_county":"Hawthorne","id":"639b3de1-a180-4778-824d-2006aa36cfdc","last_modified":1524213130406,"index":2},{"date":"2013-01-07","abbrev":"OK","gva_id":478948,"killed":4,"wounded":0,"latitude":36.1539816,"longitude":-95.992775,"city_or_county":"Tulsa","id":"8ee756fe-8866-46b0-9a05-61762509940c","last_modified":1524213129483,"index":3},{"date":"2013-01-19","abbrev":"NM","gva_id":479363,"killed":5,"wounded":0,"l
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kavyasukumar
kavyasukumar / CodeCommentExample.js
Last active December 6, 2016 16:02
Code commenting example
// Bad comment
// Dividing time by 24.623 and converting to integer
var days = parseInt(time / 24.623);
// Better code and comment
const HOURS_IN_MARS_DAY = 24.623;
// Calculate the number of full days spent on mars
var daysOnMars = parseInt(timeSpentOnMars / HOURS_IN_MARS_DAY);
I made my election predictions on Vox
http://www.vox.com/2016/11/4/13448928/interactive-
presidential-electoral-college-map-2016?
data=cnJycmRkZGRkZHJkcmRyZHJycmRkZGRkZHJycnJycmRkZG
RkcnJkcmRkZHJycnJyZGRkcmRyfDE0Nzk0MjI2ODk=
&utm_medium=social&utm_source=twitter