Skip to content

Instantly share code, notes, and snippets.

View jamesgeorge007's full-sized avatar

James George jamesgeorge007

View GitHub Profile
@jamesgeorge007
jamesgeorge007 / GUI.java
Last active February 22, 2018 12:56
This is a very simple GUI application in the swing library written in Java which computes the Net Amount based on the choices received from the user.
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class netAmount_Calculator extends JFrame
{
private Label billAmount,modeOfPayment,Discount,netAmount;
private Button discountButton,netAmountButton,Stop;
private TextField billAmount_tf,modeOfPaymnet_tf,Discount_tf,netAmount_tf;
private JComboBox cb;
String mode_of_payment[]={"Cash","Cheque","Credit Card"};
@jamesgeorge007
jamesgeorge007 / array_operations.go
Last active June 18, 2018 10:15
Go lang implementation of the basic Array operations like inserting, deleting and sorting using the Bubble sorting algorithm.
package main
import "fmt"
func main(){
var A[25] int
var n, pos, el, temp, mid, first, last int
fmt.Println("Number of elements <=25:")
@jamesgeorge007
jamesgeorge007 / web_scraping_sample.py
Last active February 22, 2018 12:56
This particular code snippet makes use of the Beautiful Soup library to extract all the links from a particular website where the '#' are skipped while './' are concatenated with https::/learncodeonline.in along with rest of the part available as part of the URL.
import requests
import bs4
res = requests.get('https://learncodeonline.in')
soup = bs4.BeautifulSoup(res.text, 'lxml')
links = soup.find_all('a', href=True)
for i in links:
@jamesgeorge007
jamesgeorge007 / array_operations.c
Last active February 22, 2018 12:55
Implementation of the basic Array manipulation operations like searching, deleting and inserting elements as long as the user wants in the C language.
#include<stdio.h>
void main()
{
int n, A[25], i, el, pos, choice, position, index = 0;
char cont='y';
printf("Number of elements:");
scanf("%d", &n);
@jamesgeorge007
jamesgeorge007 / main.js
Created March 4, 2018 13:36
Module exporting sample in Node JS.
http = require('http');
//module_one = require('./module_one.js');
module_two = require('./module_two.js');
http.createServer((request, response) =>
{
response.writeHead(200, {'Content-Type':'text/plain'});
response.write(module_two.myVariable);
module_two.myFunction();
response.end();
@jamesgeorge007
jamesgeorge007 / index.html
Last active March 8, 2018 13:24
Web page rendering sample in Node JS using the fs module with which an html file is being rendered in the browser.
<html>
<head/>
<body>
<h1> This is a webpage rendered by Node JS. </h1>
</body>
@jamesgeorge007
jamesgeorge007 / index.html
Last active March 8, 2018 13:24
A simple demonstration of Node JS routing based on the url given which also points towards the need of having assistance provided by frameworks like Express which eases the task.
<!DOCTYPE html>
<html>
<head>
<title> Index Page </title>
</head>
<body>
<p> This is the index page. </p>
</body>
</html>
@jamesgeorge007
jamesgeorge007 / index.html
Created March 18, 2018 17:54
Random template without a single line of CSS.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Plumsail</title>
</head>
<body>
@jamesgeorge007
jamesgeorge007 / sort.c
Created March 24, 2018 04:52
Sorts a matrix row-wise of order m by n.
#include<stdio.h>
int main()
{
int arr[20][20], i, j, k, m, n, temp;
printf("Number of rows and columns:\n");
scanf("%d%d", &m, &n);
printf("\n\nInput elements to the matrix:\n\n");
@jamesgeorge007
jamesgeorge007 / insights.py
Created April 15, 2018 10:27
Comparison across two twitter handles using the IBM watson Personality Insights API. It requires API keys to be generated with your IBM Bluemix account.
import sys
import operator
import requests
import json
import twitter
from watson_developer_cloud import PersonalityInsightsV2 as PersonalityInsights
def analyze(handle):
twitter_consumer_key='QGi7GvLXA9N5pn9xfGOoSVdSx'