Skip to content

Instantly share code, notes, and snippets.

@ntsh
ntsh / git-log-pretty
Created February 1, 2022 10:25
Git config
alias.lg=log --graph --abbrev-commit --decorate --date=short --format=format:'%C(bold blue)%h %C(reset) %C(auto)%s%C(reset) %C(reset) %C(bold green)%ad%C(reset) %C(auto)%d<%an>'
@ntsh
ntsh / JsonToArray-Stamps.js
Created January 17, 2017 20:31
Scripts to convert dashboard json data to array and csv
// Dependencies: Moment and Underscore
// Paste the output at https://konklone.io/json/ to get the csv data
var data = {"totalRedemptionsCount":301,"totalVisitCount":1457,"monthlyLogscount":24,"dailyLogscount":68,"totalStampsCount":1308,"dailylogrequired":true,"monthlyLogs":[{"redeemCount":19,"dailyData":{"sc":{"10":29,"19":3,"18":2,"16":2,"14":15},"vc":{"10":46,"19":3,"18":2,"16":3,"14":16},"rc":{"10":17,"16":1,"14":1}},"stampCount":51,"startDateTime":"2016-01-01T00:00:00.000Z","visitCount":70,"storeId":5206673425694720,"endDateTime":"2016-01-31T23:59:59.999Z"},{"redeemCount":0,"dailyData":{"sc":{},"vc":{},"rc":{}},"stampCount":0,"startDateTime":"2016-01-01T00:00:00.000Z","visitCount":0,"storeId":5765486922956800,"endDateTime":"2016-01-31T23:59:59.999Z"},{"redeemCount":20,"dailyData":{"sc":{"10":13,"0":3,"4":62,"17":1,"18":21,"15":16,"14":17,"27":9,"28":29,"12":4},"vc":{"10":13,"0":5,"4":71,"17":1,"18":16,"15":18,"14":15,"27":10,"28":26,"12":4},"rc":{"10":1,"0":2,"4":9,"18":1,"15":2,"14":2,"27":1,"28":2}},"s
@ntsh
ntsh / Location-Finder.js
Created December 15, 2016 18:35
Json Data to latitude longitude list
var data = {"merchants":[{"storeList":[{"address":"Unit R01 Paddington Station London W2 1HB","name":"Paddington Station","longitude":"-0.177476","latitude":"51.517596"},{"address":"Unit 53 Broadgate Link (opposite Boots) Liverpool Street Station London EC2M 7PY","name":"Liverpool street","longitude":"-0.081423","latitude":"51.519233"},{"address":"Unit 61 Victoria Station (next to M&S) London SW1V 1JT","name":"Victoria Station","longitude":"-0.143641","latitude":"51.494709"},{"address":"281 Wimbledon Park Road Southfields London SW19 6NW","name":"Wimbledon Park Road","longitude":"-0.207318","latitude":"51.44379"},{"address":"Wimbledon Station Wimbledon SW19 7NL","name":"Wimbledon Station","longitude":"-0.206437","latitude":"51.421571"},{"address":"Unit 1 The Vaults London Bridge Station SE1 9SP","name":"London Bridge Station","longitude":"-0.085975","latitude":"51.504856"},{"address":"Barry House 20-22 Worple Road Wimbledon SW19 4DH","name":"Barry House","longitude":"-0.209519","latitude":"51.420975"},{"addre
@ntsh
ntsh / designer.html
Last active August 29, 2015 14:12
designer
<link href="../core-pages/core-pages.html" rel="import">
<link href="../core-icon-button/core-icon-button.html" rel="import">
<link href="../core-toolbar/core-toolbar.html" rel="import">
<link href="../core-input/core-input.html" rel="import">
<link href="../paper-button/paper-button.html" rel="import">
<polymer-element name="my-element">
<template>
<style>
@ntsh
ntsh / designer.html
Last active August 29, 2015 14:12
designer
<link href="../core-pages/core-pages.html" rel="import">
<link href="../core-icon-button/core-icon-button.html" rel="import">
<link href="../core-toolbar/core-toolbar.html" rel="import">
<link href="../core-header-panel/core-header-panel.html" rel="import">
<link href="../paper-input/paper-input.html" rel="import">
<link href="../paper-button/paper-button.html" rel="import">
<polymer-element name="my-element">
<template>
package main
import (
"net/http"
"net/url"
"io/ioutil"
"fmt"
)
func main() {
@ntsh
ntsh / google_charts_json_to_datatable.js
Created May 15, 2013 16:03
This function demonstrate how to use Google charts to show json data in data table. http://code.google.com/apis/ajax/playground/?type=visualization#table
function drawVisualization() {
// Create and populate the data table.
var jsonData = {
"count":2,
"customerList":[
{"customerName":"manas","customerID":"manas@example.com"},
{"customerName":"neetesh","customerID":"neetesh@example.com"}
]
};
@ntsh
ntsh / dabblet.css
Created May 9, 2013 15:12
Sample Demo of a Responsive Blog like website using HTML5 and CSS. Demo: http://dabblet.com/gist/5548080
body{
margin:0;
background-color: #efefef;
}
header {
font-size: 20px;
background-color: black;
color: #cccccc;
height: 75px;
}
@ntsh
ntsh / dabblet.css
Created May 9, 2013 11:23
Simple blog layout in HTML and CSS.
body{
margin:0;
background-color: #efefef;
}
header {
font-size: 20px;
background-color: black;
color: #cccccc;
height: 75px;
}
@ntsh
ntsh / gist:4609129
Created January 23, 2013 16:27
Objective C procedure to draw a circle with Radius R
-(void) createCircle :(int) R
{
CALayer *circleLayer = [CALayer layer];
circleLayer.bounds = CGRectMake(0, 0, 2*R, 2*R);
circleLayer.position = self.view.center;
circleLayer.cornerRadius = R;
circleLayer.borderColor = [UIColor blackColor].CGColor;
circleLayer.borderWidth = 8;
[self.view.layer addSublayer:circleLayer];
}