Skip to content

Instantly share code, notes, and snippets.

View rob1121's full-sized avatar

Robinson L. Legaspi rob1121

  • Cavite, Philippines
View GitHub Profile
-- Read the docs: https://www.lunarvim.org/docs/configuration
-- Video Tutorials: https://www.youtube.com/watch?v=sFA9kX-Ud_c&list=PLhoH5vyxr6QqGu0i7tt_XoVK9v-KvZ3m6
-- Forum: https://www.reddit.com/r/lunarvim/
-- Discord: https://discord.com/invite/Xb9B4Ny
--
--
--lvim setup
vim.opt.wrap = true
vim.opt.linebreak = true
--[[
THESE ARE EXAMPLE CONFIGS FEEL FREE TO CHANGE TO WHATEVER YOU WANT
`lvim` is the global options object
]]
-- Enable powershell as your default shell
vim.opt.shell = "pwsh.exe -NoLogo"
vim.opt.shellcmdflag =
"-NoLogo -NoProfile -ExecutionPolicy RemoteSigned -Command [Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.Encoding]::UTF8;"
vim.cmd [[
{
"files.autoSave": "onWindowChange",
"workbench.editor.highlightModifiedTabs": true,
"explorer.sortOrder": "type",
"editor.cursorStyle": "block",
"editor.cursorBlinking": "smooth",
"files.trimFinalNewlines": true,
"editor.renderIndentGuides": false,
"editor.fontFamily": "Operator Mono",
"editor.find.addExtraSpaceOnTop": false,
//connect to db
$query = $handler->query("SLECT * FROM tbl_name");
$data = [];
if ($query->rowCount()) {
$data = $query->fetchAll(PDO::FETCH_OBJ);
} else {
echo "NO RESULT";
}
// good for insert query
//connect to db
$name = 'Rob';
$message = 'Test';
$sql = "INSERT INTO guestBook (name, message, posted) VALUES(?, ?, NOW())";
@rob1121
rob1121 / PDO: fetching all result
Created May 16, 2018 16:23
Fetching data using PDO
<?php
//connect to database
$query = $db->query('SELECT * FROM tbl_name');
$row = $query->fetch(); //get first row
//itirate to all data
$row = $query->fetchAll(PDO::FETCH_OBJ);
@rob1121
rob1121 / PHP PDO Connect
Created May 16, 2018 15:33
connect to database using PDO
<?php
try {
$conn = new PDO('mysql:host=127.0.0.1;dbname=app', 'root', '');
$connt->setAttr(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch(PDOException $e) {
echo $e->getMessage();
}
public function store(Request $request)
{
$db = new Db($request, new CompanyDatabase);
$db->add();
return $db->getResult();
}
@rob1121
rob1121 / mockIlluminateUploadedFile.php
Created August 8, 2016 16:39
testing file upload
private function file()
{
return new Illuminate\Http\UploadedFile(
base_path('/tests/pdf/test.pdf'),
'test.pdf',
'application/pdf',
filesize(base_path('/tests/pdf/test.pdf')),
null,
true
);
:class="['list-group-item', {'active' : isFirstPanelActive}]"