Skip to content

Instantly share code, notes, and snippets.

View vjrngn's full-sized avatar

Vijay Rangan vjrngn

View GitHub Profile
@vjrngn
vjrngn / Validator.php
Created April 18, 2015 03:52
Easy Form Validation with Laravel
<?php namespace Hotelier\FormValidation;
use Illuminate\Validation\Factory as LaravelValidator;
abstract class Validator {
/**
* Laravel's validator instance
*
* @var Validator
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="bootstrap/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
@vjrngn
vjrngn / HttpUrlBuilder.js
Last active July 9, 2016 11:30
Http url builder for creating get request params.
function HttpUrlBuilder(url) {
if (typeof url !== "string") {
throw new TypeError();
}
this.url = url;
this.cleanUrl();
}
HttpUrlBuilder.prototype.cleanUrl = function() {
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<script src="https://unpkg.com/@reactivex/rxjs@5.0.3/dist/global/Rx.js"></script>
</head>
<body>
@vjrngn
vjrngn / rest_assignment.md
Last active June 3, 2018 09:59
REST assignment

Day 2

HTML & CSS

  • HTML - Hyper Text Markup Language
  • CSS - Cascading Style Sheets

REST

  • REpresentational State Transfer
  • Architectural pattern for developing HTTP APIs.
  • REST provides a standardized way to interact with HTTP based APIs.
  1. Define a variable name of type String using var or let
  2. Define a constant TIMEOUT with a value of 1000
  3. Create a user object with the following properties
    • firstName -> String
    • lastName -> String
    • age -> Number
    • fullName -> function that returns the join (concatenation) of firstName and lastName
  4. Create an array that has the names of your family members
  5. console.log every item in the family members array (from above) using a for loop
  6. Iterate over the family members array (from above) using the forEach method on array.
@vjrngn
vjrngn / PriorityQueue.js
Created January 10, 2019 06:04
A priority queue implementation is JS
class Node {
constructor (value, priority) {
this.value = value;
this.priority = priority;
}
}
class PriorityQueue {
constructor () {
this.heap = [null];
@vjrngn
vjrngn / Person.java
Last active April 24, 2019 12:50
A simple model class using JPA
package com.example.demo;
import javax.persistence.*;
@Entity
@Table(name = "books")
public class Book {
@Id
int id;
public Book() {
@vjrngn
vjrngn / BookRepository.java
Last active April 24, 2019 12:50
Book repository
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface BookRepository extends JpaRepository<Book, int> {}
@vjrngn
vjrngn / Customer.java
Created April 24, 2019 12:54
Customer entity
package com.example.demo;
import javax.persistence.*;
@Entity
@Table(name = "customers")
public class Customer {
@Id
int id;