Skip to content

Instantly share code, notes, and snippets.

View rob1121's full-sized avatar

Robinson L. Legaspi rob1121

  • Cavite, Philippines
View GitHub Profile
@rob1121
rob1121 / vueDefaultValueForProps.vue
Created July 21, 2016 03:39
set a value on data key same name as props key to declare default value of props
export default {
data() {
return {
size: "100px"
}
},
props: ['size']
}
:class="['list-group-item', {'active' : isFirstPanelActive}]"
@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
);
public function store(Request $request)
{
$db = new Db($request, new CompanyDatabase);
$db->add();
return $db->getResult();
}
@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();
}
@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);
// good for insert query
//connect to db
$name = 'Rob';
$message = 'Test';
$sql = "INSERT INTO guestBook (name, message, posted) VALUES(?, ?, NOW())";
//connect to db
$query = $handler->query("SLECT * FROM tbl_name");
$data = [];
if ($query->rowCount()) {
$data = $query->fetchAll(PDO::FETCH_OBJ);
} else {
echo "NO RESULT";
}
{
"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,
--[[
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 [[