Skip to content

Instantly share code, notes, and snippets.

public class Vehicle{
public String color;
public String engineType;
public int wheels;
public int engine;
public void move();
public void brake();
public void stop();
}
//class Example to illustrate polymorphism with the + sign
class Example{
public void add(int a, int b){
System.out.println(a + b);
}
public void addStatement(int a, int b){
System.out.println("The sum of a and b is: " + (a+b));
}
}
interface Printable{
//it possesses no functonality within the methods.
//It just contains method signatures.
void Print();
void printToPDF(String filename);
}
class MyClass implements Printable{
public void Print(){
// add functionality
@ekumachidi
ekumachidi / Merge Sort Implementation in Java
Created October 2, 2015 19:50
Merge Sort Implementation in Java
public class MergeSort {
public static void merge(int[]a,int[] aux, int f, int m, int l) {
for (int k = f; k <= l; k++) {
aux[k] = a[k];
}
int i = f, j = m+1;
for (int k = f; k <= l; k++) {
if(i>m) a[k]=aux[j++];
import java.util.Iterator;
import java.util.NoSuchElementException;
public class ResizingArrayBag<Item> implements Iterable<Item> {
private Item[] a; // array of items
private int N = 0; // number of elements on stack
public ResizingArrayBag() {//initialize an empty array
a = (Item[]) new Object[2];
}
def new
@user = User.new
@package = Package.all
end
def create
@user = user.new(user_params)
if @user.save
redirect_to :action => ‘list’
else
CREATE TABLE Roles (
id SERIAL PRIMARY KEY,
name TEXT,
created_at TIMESTAMP,
updated_at TIMESTAMP
);
CREATE TABLE users
(
id serial NOT NULL,
@ekumachidi
ekumachidi / API.md
Created April 21, 2016 07:57 — forked from iros/API.md
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

@ekumachidi
ekumachidi / gist:aac9316496fb2ca84dcef00920fede9b
Created May 28, 2016 15:00
Create new postgres super user
Run this
"sudo -u postgres psql"
in your terminal to get into postgres
postgres=#
Run "CREATE USER new_username;"
Note: Replace new_username with the user you want to create,
<div class="row ">
<div class="col-xs-12 col-sm-4 col-md-4 col-lg-4">
<div class="db-wrapper">
<div class="db-pricing-seven">
<ul>
<li class="price">
<i class="glyphicon glyphicon-qrcode"></i>
STARTER - $0 / month
</li>