This is the reference point. All the other options are based off this.
|-- app
| |-- controllers
| | |-- admin
function addDataToForm(form, data) { | |
if(typeof form === 'string') { | |
if(form[0] === '#') form = form.slice(1); | |
form = document.getElementById(form); | |
} | |
var keys = Object.keys(data); | |
var name; | |
var value; | |
var input; |
<?php | |
public function fileStorageServe($file) { | |
// know you can have a mapping so you dont keep the sme names as in local (you can not precsise the same structor as the storage, you can do anything) | |
// any permission handling or anything else | |
// we check for the existing of the file | |
if (!Storage::disk('local')->exists($filePath)){ // note that disk()->exists() expect a relative path, from your disk root path. so in our example we pass directly the path (/…/laravelProject/storage/app) is the default one (referenced with the helper storage_path('app') | |
abort('404'); // we redirect to 404 page if it doesn't exist | |
} |
<?php | |
public function getCompaniesLogo($file) { | |
// know you can have a mapping so you dont keep the sme names as in local (you can not precsise the same structor as the storage, you can do anything) | |
// any permission handling or anything else | |
$filePath = config('fs.gallery').DIRECTORY_SEPARATOR.$file; // here in place of just using 'gallery', i'm setting it in a config file | |
// here i'm getting only the path from the root (this way we can change the root later) / also we can change the structor on the store itself, change in one place config.fs. | |
// $filePath = Storage::url($filePath); <== this doesn't work don't use | |
// check for existance | |
if (!Storage::disk('local')->exists($file)){ // as mentionned precise relatively to storage disk root (this one work well not like Storage:url() | |
abort('404'); |
<?php | |
public function getCompaniesLogo($file) { | |
// know you can have a mapping so you dont keep the sme names as in local (you can not precsise the same structor as the storage, you can do anything) | |
// any permission handling or anything else | |
$filePath = config('fs.gallery').DIRECTORY_SEPARATOR.$file; // here in place of just using 'gallery', i'm setting it in a config file | |
// here i'm getting only the path from the root (this way we can change the root later) / also we can change the structor on the store itself, change in one place config.fs. | |
// $filePath = Storage::url($filePath); <== this doesn't work don't use |
'use strict'; | |
/* | |
# Javascript Prototyping Best Practices | |
* To create a class, create a constructor function with a `Name` and assign | |
it to a variable of the same `Name`. | |
* In this constructor only define properties using `this.prop` notation |
document.getElementsByTagName('button')[0].onclick = function () { | |
scrollTo(document.body, 0, 1250); | |
} | |
function scrollTo(element, to, duration) { | |
var start = element.scrollTop, | |
change = to - start, | |
currentTime = 0, | |
increment = 20; | |
Sometimes you may want to undo a whole commit with all changes. Instead of going through all the changes manually, you can simply tell git to revert a commit, which does not even have to be the last one. Reverting a commit means to create a new commit that undoes all changes that were made in the bad commit. Just like above, the bad commit remains there, but it no longer affects the the current master and any future commits on top of it.
git revert {commit_id}'
Deleting the last commit is the easiest case. Let's say we have a remote origin with branch master that currently points to commit dd61ab32. We want to remove the top commit. Translated to git terminology, we want to force the master branch of the origin remote repository to the parent of dd61ab32:
# VSCode Nautilus Extension | |
# | |
# Place me in ~/.local/share/nautilus-python/extensions/, restrart Nautilus, and enjoy :) | |
# mkdir -p ~/.local/share/nautilus-python/extensions && cp -f VSCodeExtension.py ~/.local/share/nautilus-python/extensions/VSCodeExtension.py && nautilus -q | |
# | |
# This script was written by cra0zy and is released to the public domain | |
from gi import require_version | |
require_version('Gtk', '3.0') | |
require_version('Nautilus', '3.0') |