Skip to content

Instantly share code, notes, and snippets.

@ntsh
ntsh / twit_faves_cli.py
Created August 2, 2012 19:31
Twitter favorites of a user through command line
'''
Usage:
> python twit_faves_cli.py username
'''
import httplib
import urllib
import json
import sys
base_url = 'api.twitter.com'
@ntsh
ntsh / gist:4564746
Last active December 11, 2015 07:09
Objective C Tic Tac Toe code for checking if particular move (x,y) by the player was a winning move. where player = 'X' or 'O' TicTacToe size = 3x3 matrix contains the current state of the TicTacToe
- (int) checkWin:(char)player :(int)x :(int)y
{
int row = 0;
int col = 0;
int diag = 0;
int rdiag = 0;
for (int i = 0; i < 3; i++)
{
if(matrix[x][i] == player) col++;
if(matrix[i][y] == player) row++;
@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];
}
@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 / 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 / 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"}
]
};
package main
import (
"net/http"
"net/url"
"io/ioutil"
"fmt"
)
func main() {
@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>
@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 / 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