Skip to content

Instantly share code, notes, and snippets.

View deepakkj's full-sized avatar
🎯
Focusing

Deepak Kumar Jain deepakkj

🎯
Focusing
View GitHub Profile
package uk.ac.reading.sis05kol.mooc;
//Other parts of the android libraries that we use
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
public class TheGame extends GameThread{
//Will store the image of a ball
@deepakkj
deepakkj / JSON.html
Created September 17, 2015 16:50
Display JSON data in HTML
<!-- Display JSON data in HTML -->
<!-- This is an example to show simple JSON data in a HTML page -->
<!-- Author: Deepak Kumar Jain -->
<!-- Email me at deepakkumarjain21@gmail.com -->
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="[Display JSON data in HTML]">
<meta charset="utf-8">
@deepakkj
deepakkj / js_oops.js
Created February 22, 2016 13:28
Javascript - Namespace, Objects, Class, Constructors, Properties
<script type='text/javascript'>//<![CDATA[
window.onload=function(){
// create a global object namd myapp by checking if thre exists a another same object in the same file or another filw.
//It it exists then assign that object to the new object or else create a new object with empty methods, functions and variables.
//global namespace
var myapp = myapp || {};
//sub-namespace
myapp.event = {
@deepakkj
deepakkj / method-property.js
Created February 22, 2016 13:48
Methods are bound to an object as a property : Invoking methods which are 'out-of-context'
//creating a class named Person with a constructor
var Person = function(firstName){
this.firstName = firstName;
};
//creating prototpye function to access it, with multiple objects while it is loaded only once in memory
Person.prototype.sayHello = function(){
console.log("My name is " + this.firstName);
};
@deepakkj
deepakkj / classical_inheritance.js
Created February 23, 2016 09:54
Classical Inheritance in Javascript
//parent
var Person = function(firstName){
this.firstName = firstName;
};
Person.prototype.walk = function(){
console.log("I am walking.");
};
Person.prototype.sayHello = function(){
@deepakkj
deepakkj / prototypal_inheritance.js
Created February 23, 2016 10:03
Prototypal Inheritance in Javascript
//prototypal inheritance
//parent
var human = {
species: "human",
create: function(values) {
var instance = Object.create(this);
Object.keys(values).forEach(function(key) {
instance[key] = values[key];
});
@deepakkj
deepakkj / fetch_json_REST.html
Created February 27, 2016 17:34
Fetching JSON data using 'GET' method
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-1.11.3.js"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Deepak Kumar Jain</title>
</head>
<body>
<h1>Fetching JSON data using 'GET' method</h1>
@deepakkj
deepakkj / add_newData_json.html
Created February 27, 2016 17:40
Adding a new collection/data to JSON using 'POST' method
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-1.11.3.js"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Deepak Kumar Jain</title>
</head>
<body>
<h1>Adding a new collection/data to JSON using 'POST' method</h1>
@deepakkj
deepakkj / delete_jsonData_REST.html
Created February 27, 2016 17:42
Deleting an item in JSON data using 'DELETE' method
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-1.11.3.js"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Deepak Kumar Jain</title>
</head>
<body>
<h1>Deleting an item in JSON data using 'DELETE' method</h1>
@deepakkj
deepakkj / updata_jsonData_REST.html
Created February 27, 2016 17:45
Updating a item in JSON data using 'PUT' method
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-1.11.3.js"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Deepak Kumar Jain</title>
</head>
<body>
<h1>Updating a item in JSON data using 'PUT' method</h1>