Skip to content

Commit

Permalink
added more snips
Browse files Browse the repository at this point in the history
  • Loading branch information
timosarkar committed Dec 11, 2024
1 parent 431b494 commit d7ac570
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 2 deletions.
47 changes: 45 additions & 2 deletions files/snippets/all.snippets
Original file line number Diff line number Diff line change
@@ -1,14 +1,57 @@
snippet php ""
snippet php "simple php boiler"
<?php
$1
?>
endsnippet

snippet php-if "php conditionals"
<? if ($1): ?>
<? elseif (): ?>
<? else: ?>
<? endif; ?>
endsnippet

snippet php-composer "php composer imports"
use Dotenv\Dotenv;
require 'vendor/autoload.php';

$dotenv = Dotenv::createImmutable(__DIR__);
$dotenv->load();
endsnippet

snippet html "creates a html5 template"
<html lang="en">
<head>
<title></title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdn.tailwindcss.com"></script>
<title></title>
</head>
<body>
$1
</body>
</html>
endsnippet

snippet html-style "html style tag"
<style>
$1
</style>
endsnippet

snippet php-pages "multiple page routes"
<?php if ($_SERVER['REQUEST_URI'] == '$1'): ?>
<?php elseif ($_SERVER['REQUEST_URI'] == ''): ?>
<?php else: ?>
<?php endif; ?>
endsnippet

snippet php-sqlite "init a sqlite db using php"
try {
$db = new PDO('sqlite:users.db');
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$db->exec($1);
} catch(Exception $e) {
error_log("Database Error: " . $e->getMessage());
}
endsnippet
1 change: 1 addition & 0 deletions home.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ in
v = "vim";
e = "vim";
ls = "ls -al";
sl = "ls"; # yes this was really necessary...
add = "git add .";
commit = "git commit -m";
push = "git push";
Expand Down

0 comments on commit d7ac570

Please sign in to comment.