Skip to content

Instantly share code, notes, and snippets.

View vineeth030's full-sized avatar

Vineeth Vijayan vineeth030

  • BEO
  • Kochi
View GitHub Profile
@vineeth030
vineeth030 / htmltemplate.html
Last active April 9, 2016 15:02
HTML templae
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Test</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous">
@vineeth030
vineeth030 / pagination.php
Created April 28, 2016 06:18
Pagination with PHP & MYSQL
<?php
$num_rec_per_page=10;
mysql_connect('localhost','root','');
mysql_select_db('apex1');
if (isset($_GET["page"])) { $page = $_GET["page"]; } else { $page=1; };
$start_from = ($page-1) * $num_rec_per_page;
$sql = "SELECT * FROM student LIMIT $start_from, $num_rec_per_page";
$rs_result = mysql_query ($sql); //run the query
?>
<table>
// *Check to see if someone has clicked on a word out of the description text on the video page.*
// *If they have then do a search for that term.*
if(isset($_GET["term"]))
{
$termid = $_GET["term"];
if(is_numeric($termid))
{
zpConnectDB('zanesitecontent');
$sql = "SELECT g.id, g.term, t.name as topic, g.description FROM glossary AS g
Too long error
Add [ Schema::defaultStringLength(191); ] in AppServiceProvider.php
Bootstrap links
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
Vuejs link
<script src="https://unpkg.com/vue"></script>
Root URL [App URL] : http://phpstack-87385-243760.cloudwaysapps.com/index.php/rest/V1
Step 1 : [Get token & authenticate]
URL [ POST ]: Root URL + /integration/admin/token
Credentials :
Username : sculpapiuser1
Password : sculpapi1
Step 2 : [Get categories with token id]
@vineeth030
vineeth030 / model-factories-for-relationship-seeding
Created November 4, 2017 06:39
Model factories for relationship seeding
$factory->define(App\Student::class, function (Faker\Generator $faker) {
return [
'name' => $faker->name,
'marks' => $faker->numberBetween(0,100),
];
});
$factory->define(App\Teacher::class, function (Faker\Generator $faker) {
return [
'name' => $faker->name,
public function students()
{
return $this->hasMany(Student::class, 'student_id');
}
public function run()
{
factory(App\Teacher::class, 2)->create()->each(function ($teacher) {
$teacher->students()->saveMany(factory(App\Student::class, 25)->make());
});
}
<?php
$results = User::where('column_1', '=', 100)
->where('column_2', '>', 200)
->where('column_3', '<', 350)
->where('column_4', '=', 400)
->where('column_5', '>', 150)
->get();
<?php
$conditions = [
['column_1', '=', 100],
['column_2', '>', 200],
['column_3', '<', 350],
['column_4', '=', 400],
['column_5', '>', 150]
];