Skip to content

Instantly share code, notes, and snippets.

@menuka94
menuka94 / StudentsController.php
Created December 10, 2016 16:15
Laravel - Display Table in HTML
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class StudentsController extends Controller{
public function getAllStudents(){
$all_students = ''; // fetch data from database
return view('table_view',[
@menuka94
menuka94 / index.blade.php
Created December 10, 2016 16:19
Laravel Input Validation Message - Front End
@if(count($errors) > 0)
<div class="alert alert-danger">
<ul>
@foreach($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
@menuka94
menuka94 / master.blade.php
Last active December 10, 2016 16:23
Laravel Blade - Master Template
<!DOCTYPE html>
<html>
<head>
<title>@yield('title')</title>
<meta name="csrf-token" content="{{ csrf_token() }}" />
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<!-- Optional theme -->
@menuka94
menuka94 / authentication.js
Last active January 22, 2017 17:08
Firebase Web
const auth = firebase.auth();
auth.singInWithEmailAndPassword(email, pass);
// create new user
auth.createUserWithEmailAndPassword(email, pass);
auth.onAuthStateChanged(firebaseUser => {});
@menuka94
menuka94 / explicit-intent.java
Created January 26, 2017 17:31
Android Intents
// Executed in an Activity, so 'this' is the context
Intent intent = new Intent(this, NumbersActivity.class);
startActivity(intent);
@menuka94
menuka94 / data.json
Last active January 31, 2017 19:32
Firebase vs SQL
{
"users": {
"1": {
"name": "Max",
"bio": "Hello, I'm a programmer",
"profileImg": "https://..."
},
"9": {
"name": "Alice",
"bio": "I work as a business analyst",
@menuka94
menuka94 / FragmentLandspace.java
Last active February 5, 2017 14:08
Android Fragments - 1
package com.android.menuka.androidfragments;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
/**
@menuka94
menuka94 / ChatMessage.java
Last active February 10, 2017 06:39 — forked from puf/ChatMessage.java
Zero to App: Develop with Firebase (for Android - Google I/O 2016)
package com.google.firebase.zerotoapp;
public class ChatMessage {
public String name;
public String message;
public ChatMessage() {
}
public ChatMessage(String name, String message) {
@menuka94
menuka94 / index.html
Created February 10, 2017 06:40 — forked from puf/index.html
Zero to App: Develop with Firebase (for Web - Google I/O 2016)
<html>
<head>
<script src="https://www.gstatic.com/firebasejs/3.0.0/firebase.js"></script>
<title>ZeroToApp</title>
<style>
#messages { width: 40em; border: 1px solid grey; min-height: 20em; }
#messages img { max-width: 240px; max-height: 160px; display: block; }
#header { position: fixed; top: 0; background-color: white; }
.push { margin-bottom: 2em; }
@keyframes yellow-fade { 0% {background: #f2f2b8;} 100% {background: none;} }
@menuka94
menuka94 / MainActivity.java
Created February 11, 2017 12:57
Android List View Strings
package com.example.menuka.adaptertest;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.List;