Snippets Collections
setTimeout(function(){debugger;}, 5000)
// MARK: - Table View

topPlayersTableView.delgate = self
topPlayersTableView.dataSource = self


extension HomeViewController : UITableViewDelegate, UITableViewDataSource {
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return 10
    }
    
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = topPlayersTableView.dequeueReusableCell(withIdentifier: "TopPlayerTableViewCell") as! TopPlayerTableViewCell
        return cell
    }
}
   func setView() {
     
        [emailView, passwordView].forEach { (view) in
            if let view = view {
                view.layer.borderWidth = 2
                view.layer.borderColor = hexStringToUIColor(hex: "E9E9E9").cgColor
                view.layer.cornerRadius = view.layer.frame.height/3
            }
        }
    }
// 1st method

if let storyboard = self.storyboard {
            let vc = storyboard.instantiateViewController(withIdentifier: "ForgotPasswordViewController") as! ForgotPasswordViewController
            vc.modalPresentationStyle = .fullScreen
            self.present(vc, animated: false, completion: nil)
        }

// 2nd method

    func nextVC(identifier: String) {
        if let storyboard = self.storyboard {
            let vc = storyboard.instantiateViewController(withIdentifier: identifier)
            vc.modalPresentationStyle = .fullScreen
            self.present(vc, animated: false, completion: nil)
        }
    }
Issue: place parentview at top of all views, buttons, labels

    
    public static var BottomBarVC: BottomBarViewController!
    public static var parentViewHeight: CGFloat = 0
    
    var homeVC : HomeViewController!
    var favoriteVC : FavouriteItemsViewController!
    var profileVC : ProfileViewController!
    
    override func viewDidLoad() {
        super.viewDidLoad()

        BottomBarViewController.BottomBarVC = self
        BottomBarViewController.parentViewHeight = self.parentView.frame.height
        
        assignViewControllers()
//        setScanImage()
    }
    
    func assignViewControllers() {
        let storyboard = UIStoryboard(name: "Main", bundle: nil)
        homeVC = storyboard.instantiateViewController(withIdentifier: "HomeViewController") as? HomeViewController
        favoriteVC = storyboard.instantiateViewController(withIdentifier: "FavouriteItemsViewController") as? FavouriteItemsViewController
        profileVC = storyboard.instantiateViewController(withIdentifier: "ProfileViewController") as? ProfileViewController
        
        embedHomeVC()
    }
    
    func embedHomeVC() {
        AppDelegate.embed(self.homeVC, inParent: self, inView: self.parentView)
    }
    
    @IBAction func homeButtonPressed(_ sender: Any) {
      // C59104
      // 9A9A9A
        
        homeImageView.image = UIImage(named: "home_sel")
        homeLabel.textColor = hexStringToUIColor(hex: "C59104")
        
        favoriteImageView.image = UIImage(named: "favorite_unsel")
        favoriteLabel.textColor = hexStringToUIColor(hex: "9A9A9A")
        
        shoppingImageView.image = UIImage(named: "shopping_unsel")
        shoppingLabel.textColor = hexStringToUIColor(hex: "9A9A9A")
        
        profileImageView.image = UIImage(named: "profile_unsel")
        profileLabel.textColor = hexStringToUIColor(hex: "9A9A9A")
        
        AppDelegate.embed(self.homeVC, inParent: self, inView: self.parentView)
    }
    
    @IBAction func favoriteButtonPressed(_ sender: Any) {
      
        homeImageView.image = UIImage(named: "home_unsel")
        homeLabel.textColor = hexStringToUIColor(hex: "9A9A9A")
        
        favoriteImageView.image = UIImage(named: "favorite_sel")
        favoriteLabel.textColor = hexStringToUIColor(hex: "C59104")
        
        shoppingImageView.image = UIImage(named: "shopping_unsel")
        shoppingLabel.textColor = hexStringToUIColor(hex: "9A9A9A")
        
        profileImageView.image = UIImage(named: "profile_unsel")
        profileLabel.textColor = hexStringToUIColor(hex: "9A9A9A")
        
        AppDelegate.embed(self.favoriteVC, inParent: self, inView: self.parentView)
    }
    
    @IBAction func shoppingButtonPressed(_ sender: Any) {
      
        homeImageView.image = UIImage(named: "home_unsel")
        homeLabel.textColor = hexStringToUIColor(hex: "9A9A9A")
        
        favoriteImageView.image = UIImage(named: "favorite_unsel")
        favoriteLabel.textColor = hexStringToUIColor(hex: "9A9A9A")
        
        shoppingImageView.image = UIImage(named: "shopping_sel")
        shoppingLabel.textColor = hexStringToUIColor(hex: "C59104")
        
        profileImageView.image = UIImage(named: "profile_unsel")
        profileLabel.textColor = hexStringToUIColor(hex: "9A9A9A")
    }
    
    @IBAction func profileButtonPressed(_ sender: Any) {
      
        homeImageView.image = UIImage(named: "home_unsel")
        homeLabel.textColor = hexStringToUIColor(hex: "9A9A9A")
        
        favoriteImageView.image = UIImage(named: "favorite_unsel")
        favoriteLabel.textColor = hexStringToUIColor(hex: "9A9A9A")
        
        shoppingImageView.image = UIImage(named: "shopping_unsel")
        shoppingLabel.textColor = hexStringToUIColor(hex: "9A9A9A")
        
        profileImageView.image = UIImage(named: "profile_sel")
        profileLabel.textColor = hexStringToUIColor(hex: "C59104")
        
        AppDelegate.embed(self.profileVC, inParent: self, inView: self.parentView)
    }
    func setScrollView() {
        let contentWidth = topPlayersTableView.layer.frame.width + 20
        scrollView.contentSize = CGSize(width: contentWidth, height: scrollView.frame.height)
        scrollView.isPagingEnabled = true
    }
# ======================= [ MERGE TWO GIT BRANCH ] =======================
I have a branch named BranchA from master. I have some changes in BranchA (I am not going to merge changes from BranchA to master).
Now I have created another branch from master named BranchB.
How can I copy the changes from BranchA to BranchB?

Answer:
git checkout BranchB
git merge BranchA

or if you didn't create BranchB yet you can do:
git checkout BranchA
git checkout -b BranchB

This is all if you intend to not merge your changes back to master. Generally it is a good practice to merge all your changes back to master, and create new branches off of that.

Also, after the merge command, you will have some conflicts, which you will have to edit manually and fix.

Make sure you are in the branch where you want to copy all the changes to. git merge will take the branch you specify and merge it with the branch you are currently in.


# ======================= [ RESET A BRANCH ] =======================
-> get back to a commit by their commit id or the order.
>>> 
  Step 1: 
  	1st check on which commit you want to move to, using `git log`.
  Step 2:
  	then move to that using `git reset`, say you want to move the branch head backward by two steps. so you do --> `git reset --hard HEAD~2`
    
>>> 
      Using the commit id/commit hash might also work. But I have not tried that.
      Command: https://stackoverflow.com/a/3639154
      	`$ git reset --hard <commit-before-merge>`
       OR,
         git reset --hard <commit-hash>
         git push -f origin master
    
# ======================= [ GIT STASH ] =======================
when switching from one branch to another, if this error comes `error: The following untracked working tree files would be overwritten by checkout:`. Then you either need to stash or clean. Better is stash.

-> `git stash --include-untracked`
❌ Never do stash, it deletes all the changes that have been added after the last commit.
-> Use `git stash pop` to undeo the recent stash. 
// https://stackoverflow.com/questions/10827160/undo-a-git-stash
# ======================= [DIFF FILES] ========================
$ git diff HEAD:<version 1 of file1> <version 2 of file1>
  
git diff HEAD:Carla/carla_scripts/initialpose_recorder.py Carla/carla_scripts/initialpose_recorder.py


# ========== [UNCOMMIT A FILE FROM CURRENT/LAST COMMIT ] ==========
[https://stackoverflow.com/questions/12481639/remove-file-from-latest-commit]
- git reset --soft HEAD~1
- git restore --staged path/to/unwanted_file
- git commit -c ORIG_HEAD
 
# ==========   [GIT COMMIT W/O MESSAGE]   =========
 - git commit -am.

# ============  [GIT BRANCHES]  =====================
 - `git branch -a`  => shows all branches
 - `git branch -r` => shows only remote branches
 - `git branch`    => shows only local branches
 - `git checkout <branch name>`  => add a remote branch to your local
 - if you are upable to add branch using git checkout you might need to do `git fetch -all`. then do `git checkout <branch name>` again.
 
 
 # ===============  [REGULAR GIT COMMANDS WHEN WORKING @ ALIVE]  =======================
 - git status
 - git add commonroad_dev/ [NEVER DO `git add .`, if needed add the whole folder]
 - git commit -m "message"
 - git push -u origin <branch-name>
   
   
# ==================  [CREATE A GIT BRANCH] ===========================
   - git branch my_branch    [This create a branch named `my_branch`] 
   - git checkout my_branch  [after creatng you switch to the `my_branch`]
 

#=================== [GIT REBASE]  ==============================

  - https://github.com/soumya997/alive-test/blob/main/git_rebase.md 
   func setProfileImage() {
        profileImageView.frame.size = CGSize(width: profileImageView.frame.height,
                                                  height: profileImageView.frame.height)
        profileImageView.layer.cornerRadius = profileImageView.layer.frame.height/2
        profileImageView.center.x = view.center.x
    }
const http = require('http');  
// Create an instance of the http server 
// to handle HTTP requests
let app = http.createServer((req, res) => {
    // Set a response type of plain text 
//     for the response
...    res.writeHead(200, {'Content-Type': 'text/plain'});
    // Send back a response and end the connection
...    res.end('Hello World!\n');
});
// Start the server on port 3000
app.listen(3000, '127.0.0.1');
console.log('Node server running on port 3000');
[su_slider source="media: 1650,1648,1649" link="image" target="blank" responsive="yes" title="no" arrows="yes" pages="no" mousewheel="no"]
[su_animate type="bounceIn" duration="1"]Animated content[/su_animate]
[su_tooltip title="Tooltip title" text="Tooltip content" position="top" background="#222222" color="#FFFFFF" font_size="16" text_align="left" max_width="300" radius="5" shadow="no" behavior="hover" class="" outline="yes" tabindex="yes" reference_tag="span" hide_delay="0"] Hover me to open tooltip [/su_tooltip]
[su_dropcap style="default" size="3"]L[/su_dropcap]orem ipsum dolor sit amet, consectetur adipiscing elit. Aenean urna nisl, sodales et mauris eget, egestas ullamcorper tellus. Quisque suscipit turpis a libero ultrices, non pharetra velit ornare.
[su_photo_panel color="#F73F43" border="1px solid #F73F43" radius="3" text_align="center" photo="https://getshortcodes.com/wp-content/uploads/2017/08/slider-image-1.jpg" url="#"]This is photo panel[/su_photo_panel]
[su_row]
[su_column size="1/3"]
[su_panel]Panel content[/su_panel]
[/su_column]
[su_column size="1/3"]
[su_panel]Panel content[/su_panel]
[/su_column]
[su_column size="1/3"]
[su_panel]Panel content[/su_panel]
[/su_column]
[/su_row]
[su_panel color="#F73F43" border="1px solid #F73F43" radius="3" text_align="center" url="#"]Panel content. You can use any <strong>HTML markup</strong> or even other shortcodes here.[/su_panel]
<strong>Mixed content</strong>
[su_content_slider effect="goDown" autoplay="0" style="dark" pages="yes"]
[su_content_slide]
[su_spoiler title="Spoiler shortcode" style="fancy" icon="plus-square-1"]Hidden content[/su_spoiler]
[/su_content_slide]
[su_content_slide]
[su_service title="Service shortcode" icon="icon: star" icon_color="#fccb00"]Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris ligula libero, placerat ac pellentesque eget, adipiscing eu sapien. In venenatis, orci sed fringilla eleifend, nulla urna egestas arcu, quis consectetur felis purus sed metus. Quisque convallis lobortis neque, vitae rutrum urna mattis quis. Donec molestie tempor mattis. Sed elementum, est vitae tincidunt faucibus, metus dui lobortis orci, non auctor ipsum elit quis nunc. Integer nec mattis nunc, eu dapibus nisl. Proin in eleifend lorem. Praesent mattis eros in orci aliquet fermentum.[/su_service]
[su_box title="Box shortcode" box_color="#dddddd" title_color="#393939"]Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris ligula libero, placerat ac pellentesque eget, adipiscing eu sapien. In venenatis, orci sed fringilla eleifend, nulla urna egestas arcu, quis consectetur felis purus sed metus. Quisque convallis lobortis neque, vitae rutrum urna mattis quis.[/su_box]
[/su_content_slide]
[su_content_slide]
[su_row][su_column size="1/2"]
<h3>YouTube video</h3>
[su_youtube url="http://www.youtube.com/watch?v=DR2c266yWEA"]
[/su_column][su_column size="1/2"]
<h3>Google map</h3>
[su_gmap]
[/su_column][/su_row]
[/su_content_slide]
[/su_content_slider]
[su_icon icon="icon: star" background="#eeeeee" color="#F73F43" text_color="#F73F43" size="32" shape_size="16" radius="256" text_size="16" url="#" target="self" margin="0"] This is a custom icon [/su_icon]
star

Wed Nov 13 2024 22:12:50 GMT+0000 (Coordinated Universal Time)

#debugger #snippet
star

Fri Jan 27 2023 17:21:38 GMT+0000 (Coordinated Universal Time)

#ios #swift #table #tableview #snippet
star

Fri Jan 27 2023 17:17:47 GMT+0000 (Coordinated Universal Time)

#ios #swift #view #snippet
star

Fri Jan 27 2023 17:13:07 GMT+0000 (Coordinated Universal Time)

#ios #swift #vc #next #nextvc #snippet
star

Fri Jan 27 2023 17:06:39 GMT+0000 (Coordinated Universal Time)

#ios #swift #bottombar #bottom #tab #tabbar #snippet #snipet #snipit #code
star

Wed Jan 25 2023 15:36:09 GMT+0000 (Coordinated Universal Time) https://chat.openai.com/chat/07129f0f-4c3a-4dc4-892c-f0353b6ad551

#ios #swift #scroll #horizontal #snippet
star

Wed Oct 12 2022 07:03:16 GMT+0000 (Coordinated Universal Time)

#git #boilerplate #snippet
star

Tue Mar 15 2022 11:50:41 GMT+0000 (Coordinated Universal Time)

#ios #swift #profileimage #image #profile #snippet
star

Sat Feb 26 2022 08:28:58 GMT+0000 (Coordinated Universal Time) http://psyopwriter.com

#https #server #javascript #serverup #snippet
star

Sat Jan 08 2022 08:25:56 GMT+0000 (Coordinated Universal Time) https://getshortcodes.com/docs/slider/

#slider #wp #snippet
star

Sat Jan 08 2022 08:24:30 GMT+0000 (Coordinated Universal Time) https://getshortcodes.com/docs/animation/

#animation #snippet
star

Sat Jan 08 2022 08:24:04 GMT+0000 (Coordinated Universal Time) https://getshortcodes.com/docs/tooltip/

#tooltip #snippet #wp
star

Sat Jan 08 2022 08:18:33 GMT+0000 (Coordinated Universal Time) https://getshortcodes.com/docs/dropcap/

#snippet #shortcode #wp
star

Sat Jan 08 2022 08:06:15 GMT+0000 (Coordinated Universal Time) https://getshortcodes.com/docs/photo-panel/

#img #snippet #shortcode
star

Sat Jan 08 2022 08:05:21 GMT+0000 (Coordinated Universal Time) https://getshortcodes.com/docs/panel/

#snippet #column #wp
star

Sat Jan 08 2022 08:04:55 GMT+0000 (Coordinated Universal Time) https://getshortcodes.com/docs/panel/

#snippet #wp #shortcode
star

Sat Jan 08 2022 08:03:22 GMT+0000 (Coordinated Universal Time) https://getshortcodes.com/docs/content-slider/

#snippet #wp #shortcode #slider
star

Sat Jan 08 2022 08:01:28 GMT+0000 (Coordinated Universal Time) https://getshortcodes.com/docs/icon/

#snippet #wp #shortcode #icon

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension