~/dev which contains several subdirectories, consisting of directory for github projects, directory for Android SDK, directory for libraries, directory for my own projects etc. I add all development related stuff in subfolders of this directory.If it were neededWhere do u keep ur portions of incomplete reusable code (which includes templates, snippets, ecc.)?
In ~/dev/resources/templates/ ?
In ~/resources/templates/ ?
<?php
class {NAME} {
public ${PROPERTY1};
public ${PROPERTY2};
public ${PROPERTY3};
function __construct(...) {
$this->{PROPERTY1} = ...;
$this->{PROPERTY2} = ...;
$this->{PROPERTY3} = ...;
}
function {METHOD}() {
...
}
}
define('YOUR_APP_ID', 'YOUR APP ID');
//uses the PHP SDK. Download from https://github.com/facebook/php-sdk
require 'facebook.php';
$facebook = new Facebook(array(
'appId' => YOUR_APP_ID,
'secret' => 'YOUR APP SECRET',
));
$userId = $facebook->getUser();
What if I want to use them for multiple projects?Snippets should be part of your project because IDE normally uses some default location where you put them.
Explain yourself betterI don't use templates, templates are only useful for replicating unit tests, but you don't replicate your main project on which you're working,
Explain yourself betterunless you're learning and need to start over every now and then to follow a book or something.
Git generally contains standalone code, meaning libraries that, once "loaded" (and possibly configured) into your project, can run smoothly without any intervention.Reusable code, on github and then downloading zip to external storage.
What kind of libraries?My tree is all under~/devwhich contains several subdirectories, consisting of directory for github projects, directory for Android SDK, directory for libraries,
$HOME or $HOME/dev ?directory for my own projects etc. I add all development related stuff in subfolders of this directory.
Another benefit of having it all in home
What do you mean?is you don't need root privileges to upgrade build tools, IDE etc.
phpWhat are you working on? which language are you learning?
Doesn't matter if you use same IDE for multiple projects. default snippets directory is set in IDE, but it may be possible to direct it to your custom directory so it doesn't matter where you put them, you have freedom to configure your project/IDE however you want.What if I want to use them for multiple projects?
Have you never heard of unit tests? you have 1 template that is bare minimum for unit test and then copy it when needed to write new unit test.Explain yourself better
Explain what? you should explain instead how you plan to use templates, why do you even need them?Explain yourself better
So by "template" your referring to VS templates?Reusable code is another matter (a more personal thing): https://www.linux.org/threads/progr...code-templates-snippets-ecc.57611/post-275597
Boost for instance, and any other that may affect multiple projects, otherwise libraries should be part of your project, e.g. your project directory should contain a directory called "External" or "3rd Party" where you put libraries that your project depends on.What kind of libraries?
An example?
$HOME or $HOME/dev ?
~/dev means $HOME/devAndroid studio and SDK for instance if installed system wide will fail to upgrade using UI because you don't have permissions since the IDE is started as standard user.What do you mean?
Explain yourself better.
A concrete example?
Is language not a project.
I see you're referring to file template in MS's parlance that is in VS, well this should rather be a snippet because it's much easier to get starting code with a key press than navigating 5 steps in GUI with a mouse.Template example: Generic model to model/adapt/sculpt into your project
$ xdg-user-dir TEMPLATES
/home/MY-NAME/Templates
The templates or the snippets?I put them on "postit notes" - but my postit notes are searchable text files ( a la zettelkasten ) - I left paper postit notes behind a long time ago.
I do not use ide (not always).Doesn't matter if you use same IDE for multiple projects. default snippets directory is set in IDE, but it may be possible to direct it to your custom directory so it doesn't matter where you put them, you have freedom to configure your project/IDE however you want.
I need a fragment of code to log inHave you never heard of unit tests? you have 1 template that is bare minimum for unit test and then copy it when needed to write new unit test.
Explain what? you should explain instead how you plan to use templates, why do you even need them?
That's exactly what I'm askingThen I can explain whether that's normal or whether there is better method.
I don't use VSSo by "template" your referring to VS templates?
I do not use IDE (not always), as I have already said: especially if I have to make interventions on the fly like correcting some not particularly insidious bugs.IDE specific templates are for convenience and for beginners, most people will want to start writing their new project from zero.
????Those templates are again only useful for unit tests just like non VS specific templates, I see no purpose of them for anything else because 99% of coders deal with some specific project instead of starting from scratch and dropping their work every time they want to code
I am writing a WordPress pluin Er Collecting data on visitorsI was hoping you share what are you're dealing with to give you advice
There is no functional difference, how you lay out your project structure is entirely up to you.But the question is always the one in the initial post: like location it is better
~/dev/resources/templates/login.php
or
~/resources/templates/login.php
?
~/resources or even better ~/res to type less.????
bohh
In that case I can't help, web development workflow is different from desktop development.I am writing a WordPress pluin Er Collecting data on visitors
Err, I didn't read all the back 'n forth when this thread got long, so I kinda fast-forwarded to the last post. Anyway here's a simple solution:I need a fragment of code to log in
$ cat ~/dev/resources/templates/login.php
I copy the text
$ gedit ~/dev/projects/my-project/src/loginclass.php
I paste and scaling a corrections/suitable.
But the question is always the one in the initial post: like location it is better
~/dev/resources/templates/login.php
or
~/resources/templates/login.php
?
Pretty much everything - code snippets, templates (which are really just big shell script snippets), instructions for setting the clock on my car radio, how to change the belt on my lawn mower, my home-brew chili recipes. Even my master password list, although that one is encrypted. Every "postit note" (except the encrypted ones) is a simple text file.The templates or the snippets?
Explain what you're talking about.
I put them on "postit notes"
What does it mean?