Skip to content

Instantly share code, notes, and snippets.

View subbu's full-sized avatar

Subbu Athikunte subbu

  • Bangalore, India
View GitHub Profile
@subbu
subbu / README.md
Last active April 19, 2017 18:05
LPG Usage by SimplyGuest Tenants

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

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 February 16, 2010 14:20
jQuery style guide & practices
//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);
_ 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.
#!/bin/bash
#Assuming we are deploying to a intranet. Otherwise replace the below IP to actual address.
[email protected].$1
echo 'Deploying to $server'
ssh $server '
deploy_to=/home/deploy/builds &&
cd $deploy &&
echo "Creating deployment folders in $PWD" &&
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.
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:
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))
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