Skip to content

Instantly share code, notes, and snippets.

Subbu Athikunte subbu

Block or report user

Report or block subbu

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
@subbu
subbu / README.md
Last active Apr 19, 2017
LPG Usage by SimplyGuest Tenants
View README.md

SimplyGuest houses come with a fully functional kitchen. As part of it, we provide a gas stove and provide unlimited LPG.

We have one LPG connection per house. Over the last one year we have replaced 77 cylinders. That's 3.3 cylinders per house. A cylinder purchased every 5 days. Some houses have never exhausted their very first cylinder, while one particular house consumes one complete cylinder every month.

Are exits linked anyway to LPG usage?

LPG usage is an indication of how close the flatmates have become. Its difficult to cook for just oneself. So most people, even the ones who love cooking, often eat outside or get food delivered home. The following chart shows house-wise usage of LPG and their exits. Bars in the chart are rarely balanced, they are heavier one one side most of the time. Houses that use up more LPG have fewer exits. The opposite is also true. That's good news for us. Customer acquisition cost is a lot higher than LPG cylinder cost.

We see many flatmates hire an external cook. Th

View late row lookup in MySQL.sql
SELECT p.id, name, LENGTH(body) AS len
FROM (
SELECT id
FROM projects
ORDER BY id
LIMIT 150000, 10
) o
JOIN projects p
ON p.id = o.id
ORDER BY p.id
@subbu
subbu / jQuery style guide & practices.js
Created Feb 16, 2010
jQuery style guide & practices
View jQuery style guide & practices.js
//h2. General
//* Use $(function(){...}) instead of $(document).ready();
//h2. Selectors
//* Prefix all jQuery variable with $ except in one case. (The exception is defined in the next point). This helps to remember that this variable is a jQ variable.
//* Name reference to the current element as e within a callback. eg.
$('.class').live('click', function(){
var e = $(this);
View Ruby Style Guide
_ Fork of Christian Neukirchen's Ruby Style Guide. Edited/Modified to suit my style. _
h1. Ruby Style Guide
h2. Formatting:
* Use ASCII (or UTF-8, if you have to).
* Use an empty line before the return value of a method (unless it
only has one line), and an empty line between defs.
View 1-setup-deploy-server.sh
#!/bin/bash
#Assuming we are deploying to a intranet. Otherwise replace the below IP to actual address.
server=subbu@192.168.1.$1
echo 'Deploying to $server'
ssh $server '
deploy_to=/home/deploy/builds &&
cd $deploy &&
echo "Creating deployment folders in $PWD" &&
View gist:228136
Basic sales tax is applicable at a rate of 10% on all goods, except books,
food, and medical products that are exempt. Import duty is an additional
sales tax applicable on all imported goods at a rate of 5%, with no
exemptions.
When I purchase items I receive a receipt which lists the name of all the
items and their price (including tax), finishing with the total cost of the
items, and the total amounts of sales taxes paid. The rounding rules for
sales tax are that for a tax rate of n%, a shelf price of p contains
(np/100 rounded up to the nearest 0.05) amount of sales tax.
View inputs.yml
input_1:
item_1: 1 book at 12.49
item_2: 1 music CD at 14.99
item_3: 1 chocolate bar at 0.85
input_2:
item_1: 1 imported box of chocolates at 10.00
item_2: 1 imported bottle of perfume at 47.50
input_3:
View sales_tax_tests.rb
require 'test/unit'
class TestSalesTaxApp < Test::Unit::TestCase
def setup
# load the inputs
require 'sales_tax.rb'
end
def test_rounding_off
assert_equal(78.9, 78.876.round_to(1))
View sales_tax.rb
require 'yaml'
module Tax
SALES_TAX = 10
SALES_TAX_EXEMPTIONS = ['book', 'chocolate', 'pills' ]
IMPORT_DUTY = 5
end
# There is no standard method that rounds off a float to 2 decimals.
class Float
You can’t perform that action at this time.