Skip to content

Instantly share code, notes, and snippets.

🏠
(在家工作) Working from home

Lasse R LasseRafn

🏠
(在家工作) Working from home
View GitHub Profile
View laravel-nav-item.php
<?php
namespace App\Nav;
class NavItem {
public static function render($routeName, $text = '') {
return '<li' . ($routeName === \Route::currentRouteName() ? 'class="active"' : '') . '><a href="' . route($routeName) . '">' . $text . '</a></li>';
}
}
View file-upload.js
function generateFormData() {
// define upload field
let file_input = document.getElementById('profile_picture');
// define form data
let data = new FormData();
// Add regular text field
data.append("name", "John Doe");
View FIK.php
<?php
class FIK
{
const REQUIRED_LENGTH = 15;
const INVOICE_ID = 0;
const REMINDER_ID = 3;
public function generate( $invoiceNumber = 1, $isReminder = false ): string
{
View help.css
#login {
position: absolute;
left: 50%;
top: 50%;
margin-left: -150px; /* halvdelen af input bredden */
margin-top: -34px; /* halvdelen af input højde x 2 + input margin-bottom */
}
/* eller bare brug flexbox */
body {
View webpack.mix.js
const {mix} = require('laravel-mix');
mix.js('js/app.js', 'public/js')
.sass('sass/app.sass', 'public/css')
.version();
View index.php
<?php
require_once 'vendor/autoload.php';
require_once 'mix.php';
?>
<!DOCTYPE html>
<html>
<head>
</head>
<title>Demo</title>
<link rel="stylesheet" href="<?php echo mix('public/css/app.css'); ?>" />
View mix.php
<?php
if (! function_exists('mix')) {
/**
* Get the path to a versioned Mix file.
*
* @param string $path
* @param string $manifestDirectory
* @return \Illuminate\Support\HtmlString
*
* @throws \Exception
View package.json
{
"private": true,
"scripts": {
"dev": "node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"hot": "node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"production": "node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"dependencies": {
"cross-env": "^3.2.3",
View webpack.mix.js
const {mix} = require('laravel-mix');
mix.js('js/app.js', 'public/js')
.sass('sass/app.sass', 'public/css');
View what-the-hell.md

app.js

This file is added ABOVE all other scripts in the HTML

window.$ = window.jQuery = require('jquery');

home.js

This file is loaded below app.js (as stated above)

$("body").html('Testing');
You can’t perform that action at this time.