Skip to content

Instantly share code, notes, and snippets.

@bani
bani / ga-ec-transactions.liquid
Last active August 29, 2015 14:04
Code to be added to Checkout under "Additional content & scripts" in order to send transaction data to Google Analytics using Enhanced Ecommerce (Universal)
<script type="text/javascript">
{% for line_item in order.line_items %}
ga('ec:addProduct', {
'id': '{{line_item.id}}',
'name': '{{line_item.product.title}}',
'category': '{{line_item.product.type}}',
'brand': '{{line_item.vendor}}',
'variant': '{{line_item.variant.option1}} {{line_item.variant.option2}} {{line_item.variant.option3}}',
'price': '{{line_item.price | money_without_currency}}',
'quantity': {{line_item.quantity}}
@bani
bani / ga-ec-impressions.liquid
Created July 20, 2014 01:27
Add inside {% for product in collection.products %} in collection.liquid
<script type="text/javascript">
ga('ec:addImpression', {
'id': '{{ product.id }}',
'name': '{{product.title}}',
'category': '{{product.type}}',
'brand': '{{product.vendor}}',
'list': '{{collection.title}}'
});
</script>
@bani
bani / ga-ec-actions.liquid
Last active August 29, 2015 14:04
Add to product.liquid
<script type="text/javascript">
ga('ec:addProduct', {
'id': '{{ product.id }}',
'name': '{{product.title}}',
'category': '{{product.type}}',
'brand': '{{product.vendor}}'
});
ga('ec:setAction', 'detail');
</script>
@bani
bani / pebble_inbox_received_handler.c
Created February 16, 2016 01:07
inbox_received_handler C implementation for Pebble configuration
static void inbox_received_handler(DictionaryIterator *iter, void *context) {
APP_LOG(APP_LOG_LEVEL_DEBUG, "New gem color received");
Tuple *gem_color_t = dict_find(iter, KEY_GEM_COLOR);
if (gem_color_t) {
int gem_color = gem_color_t->value->int32;
persist_write_int(KEY_GEM_COLOR, gem_color);
set_background_gem(gem_color);
Layer *window_layer = window_get_root_layer(window);
layer_mark_dirty(window_layer);
@bani
bani / pebble_set_background.c
Created February 16, 2016 01:23
Pebble watchface background image example code
static void set_background_gem(int color) {
APP_LOG(APP_LOG_LEVEL_DEBUG, "Updating background gem");
if (s_bitmap) gbitmap_destroy(s_bitmap);
switch(color) {
case 0:
s_bitmap = gbitmap_create_with_resource(RESOURCE_ID_DIAMOND);
break;
case 1:
s_bitmap = gbitmap_create_with_resource(RESOURCE_ID_DIAMONDAQUA);
break;

Keybase proof

I hereby claim:

  • I am bani on github.
  • I am bani (https://keybase.io/bani) on keybase.
  • I have a public key ASB6bQcID9mxh9UpeFkU4W-w1a4neKqar_glFpnhN64eTQo

To claim this, I am signing this object:

import csv
import glob
from datetime import datetime
def process_file():
data = []
for filename in glob.glob("csse_covid_19_data/csse_covid_19_daily_reports/*.csv"):
with open(filename, "r") as csvfile:
reader = csv.reader(csvfile)