gh_labels:
bug:
description: Bugfixes in codebase when something is not working.
colour: 'd73a4a'
feature:
description: New enhancements and features.
colour: '1B6659'
documentation:
description: Improvements or additions to docs.
colour: '0075ca'
release:
description: Indicates a new release.
colour: '108a51'
config:
description: Configuration and meta-infrastructural changes.
colour: '8ed92e'
refactor:
description: Code refactoring.
colour: 'D0EFCD'
question:
description: Further information requested.
colour: 'd876e3'
data:
description: Issues pertaining to data or data preparations.
colour: 'FAA631'
tests:
description: Issues related to tests.
colour: 'e4e669'
gh_labels:
bug:
description: Bugfixes in codebase when something is not working.
colour: 'd73a4a'
feature:
description: New enhancements and features.
colour: '1B6659'
documentation:
description: Improvements or additions to docs.
colour: '0075ca'
release:
description: Indicates a new release.
colour: '108a51'
config:
description: Configuration and meta-infrastructural changes.
colour: '8ed92e'
refactor:
description: Code refactoring.
colour: 'D0EFCD'
question:
description: Further information requested.
colour: 'd876e3'
data:
description: Issues pertaining to data or data preparations.
colour: 'FAA631'
tests:
description: Issues related to tests.
colour: 'e4e669'
/// Groups the elements in a collection using a block.
///
/// @param collection An object that implements @c NSFastEnumeration.
/// @param block A block that takes an element in @c collection as its only
/// argument and returns a key by which to group the element.
/// The return value is required to implement @c NSCopying.
/// The block must not be @c nil .
///
/// @returns A dictionary that maps the keys returned by @c block to a set of all
/// values in @c collection that share the same key.
///
/// Examples:
/// @code
/// NSArray *numbers = @[ @1, @2, @3, @4, @5 ];
///
/// NSDictionary *grouped = ASTGroupBy(numbers, ^(NSNumber *number){
/// return number.integerValue % 2 == 0 ? @"even" : @"odd";
/// });
///
/// grouped[@"even"]; /// { @2, @4 }
/// grouped[@"odd"]; /// { @1, @3, @5 }
/// @endcode
ASTERISM_OVERLOADABLE NSDictionary *ASTGroupBy(id<NSFastEnumeration> collection, id<NSCopying> (NS_NOESCAPE ^block)(id obj)) {
return __ASTGroupBy_NSFastEnumeration_block(collection, block);
}
Using Git and Heroku
1) In terminal - git init
This creates a hidden file .git
2) git add .
This will creating a new copy of the work. This is a staging area.
3) git commit -m "Initial Commit"
This will making a commit of the version
[ These stages can be done using GitHub Desktop]
4) Then on terminal: heroku login
This will offers to open a browser. On the window that opened log in and close the window.
5) $ heroku git:remote -a <name> if already created on heroku - or - heroku create
this will show something like this in terminal:
https://still-gorge-92777.herokuapp.com/ | https://git.heroku.com/still-gorge-92777.git
6) Create Procfile
$ touch Procfile
7) Find Procfile (should be empty) and add: web: node app.js (same file as we use for starting the application with nodemon).
8) Need to change port address to heroku’s dynamic port:
let port = process.env.PORT;if (port == null || port == "") { port = 3000;};app.listen(port, function () { console.log("Server started successfully");});
9) Choose a database host - we already have that so ignore.
10) Language specific setup:
Need to specify the version of node to heroku:
in terminal: $ node --version,
then in package.json add:
"engines": { "node": "12.x" } [or whatever version. No need to be totally specific hence the ‘x’]. Can insert before the dependencies start.
11) Create .gitingnore file:
touch .gitignore and in .gitignore:
/node_modules
npm-debug.log.
DS_Store
/*.env
12) Deploy on heroku:
Before deploying - push to git one more time for last changes to be added:
git add .
git commit -m “<chanages made to go in here>”
$ git push heroku master
[note: at this point I had an error message: ‘error: src refspec master does not match any’.
I needed to change the branch from ‘main’ on the bottom left of vs code to ‘master’ by adding a branch master through vs code. I then pushed again and it worked.]
Committing directly to git:
https://stackoverflow.com/questions/46877667/how-to-add-a-new-project-to-github-using-vs-code - below is the relevant content:
1) Navigate to the local project directory and create a local git repository: (already done above)
git init
2) Once that is successful, click on the 'Source Control' icon on the left navbar in VS-Code.One should be able to see files ready to be commit-ed. Press on 'Commit' button, provide comments, stage the changes and commit the files. Alternatively you can run from CLI (already done abovre)
git commit -m "Your comment"
3) Now you need to visit your GitHub account and create a new Repository. Exclude creating 'README.md', '.gitIgnore' files. Also do not add any License to the repo. Sometimes these settings cause issue while pushing in.
4) Copy the link to this newly created GitHub Repository.
5) Come back to the terminal in VS-CODE and type these commands in succession:
git remote add origin <Link to GitHub Repo> //maps the remote repo link to local git repo
git remote -v //this is to verify the link to the remote repo
git push -u origin master // or main // pushes the commit-ed changes into the remote repo
6) You can see the success message in the Terminal. You can also verify by refreshing the GitHub repo online.
Once done can change branch used from master to main:
To switch the default branch used to deploy apps from master to main, first create a new branch locally:
git checkout -b main
Next, delete the old default branch locally:
git branch -D master
From there, the local environment only knows about the main branch.
Reset the GIT repository hosted on the Heroku Platform using the heroku-reset command from the heroku-repo CLI plugin. Doing so will not impact the running application. (Note: Please communicate this change with your team. If you are working with other developers who are not aware of the reset, they might push to "master" which will overwrite the reset).
Re-deploy the application using the new default branch:
git push heroku main
To push directly to github:
The git push command takes two arguments:
A remote name, for example, origin
A branch name, for example, main
For example:
git push <REMOTENAME> <BRANCHNAME>
/*
* select Clone or Download and Use SSH
* You will get a URL for the SSH protocol in the form git@github.com:<user>/<repo>.git
* Then run the following command in your working tree to tell Git to use this URL instead of the current one
*/
git remote set-url origin git@github.com:<user>/<repo>.git
Comments