Skip to content

Instantly share code, notes, and snippets.

@kgrz
kgrz / inline_css.rb
Last active March 16, 2024 15:34
Jekyll Plugin to embed CSS inline in a HTML file. Useful for embedding Above the Fold CSS content if it's in a different file.
# Usage:
# This adds a tag by the name `inline_css`. It takes one argument which is the
# path to a CSS file without any quotes:
#
# {% inline_css public/css/atf.css %}
#
# This would then read the file in the given directory relative to the root of
# the Jekyll installation and then embed that CSS at that location.
#
# Installation:
#!/bin/bash
curl 'https://2.rome.api.flipkart.com/api/4/page/fetch' -X POST \
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:96.0) Gecko/20100101 Firefox/96.0' \
-H 'Accept: */*' \
-H 'Accept-Language: en-US,en;q=0.5' \
-H 'Accept-Encoding: gzip, deflate, br' \
-H 'Content-Type: application/json' \
-H 'X-User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:96.0) Gecko/20100101 Firefox/96.0 FKUA/website/42/website/Desktop' \
-H 'Origin: https://www.flipkart.com' \
@kgrz
kgrz / workaround.md
Created June 20, 2016 05:12
Possible workaround for installing nokogiri 1.6.8 on OSX with brewed libxml2 2.9.4

Problem:

The following commands fail on OSX:

gem install nokogiri
gem install nokogiri -- --use-system-libraries
gem install nokogiri -- --use-system-libraries --with-xslt-dir=/usr/local/opt/libxslt --with-xml2-dir=/usr/local/opt/libxml2

Version:

@kgrz
kgrz / temp
Created December 17, 2021 08:14
~/Documents/flipkart/rukmini-debug master
g c
[master dd4f1e4] X
1 file changed, 13 insertions(+), 38 deletions(-)
rewrite README.md (64%)
~/Documents/flipkart/rukmini-debug master ⇡
g p
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
[
{
"date": "2021-01-01",
"events": [
{
"name": "Team Standup",
"time": "2021-01-01 10:00:00 +0530",
"duration_minutes": 30,
"accepted": false
},
// Current implementation, which won't have feedback loop closed with PX, and
// allows for false positives
class PXFilter implements Filter {
private PerimeterX enforcer;
public void init() {
PXConfiguration pxConfiguration = PXConfiguration.builder()
.build();
enforcer = new PerimeterX(pxConfiguration);
}
curl 'https://2.rome.api.flipkart.com/api/4/page/fetch' \
-H 'Connection: keep-alive' \
-H 'Pragma: no-cache' \
-H 'Cache-Control: no-cache' \
-H 'sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="96", "Google Chrome";v="96"' \
-H 'X-User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4655.5 Safari/537.36 FKUA/website/42/website/Desktop' \
-H 'Content-Type: application/json' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4655.5 Safari/537.36' \
-H 'sec-ch-ua-platform: "macOS"' \

You won't be judged on you colour choices or general neatness of the UI, so no need to spend too much time deciding colours. Some logical separation of the contents, even if they're completely black-and-white is fine. You will, however, be judged on code-organisation, naming.

  1. Build a month's view of a calendar
    • There are three states for each event: A full day event, a timed event that's accepted, a timed event that's not accepted. Try to represent these states in the UI, similar to any other calendar app.
  • The month's view should show the overflow days from previous month and
@kgrz
kgrz / lvn.md
Created August 12, 2021 15:08 — forked from mtds/lvn.md
Linux Virtual Networking

Virtual Networking on Linux

In the Linux Kernel, support for networking hardware and the methods to interact with these devices is standardized by the socket API:

                +----------------+
                |   Socket API   |
                +-------+--------+
                        |
User space              |
@kgrz
kgrz / mongoid3_sinatra_config.rb
Created August 22, 2012 17:04
A Better Mongoid Sinatra configuration implementation. Using settings hash for db options sucks!
# This is a modification of the blogpost on how to use Mongoid and Sinatra.
# Here is the original blogpost http://www.garrensmith.com/2010/09/11/Mongoid-sinatra.html
# The modification lets you use Mongoid 3.0 with the new Moped driver
# The new Moped driver uses the Sessions component to define the MongoDB connection rather
# than the Mongo::Connection.new that is used in the case of the default Ruby driver.
# Moped::Session.new vs Mongo::Connection.new
# Mongoid.load!(yaml_config.yml) is used to build the config hash. Alternatively, the hash can
# be built manually by using Mongoid.config {|config| ...} syntax. The config.sessions hash