Snippets Collections
 // HTML

 <div className='container' data-columns="4">
          <div className="container__block container__block--image1"></div>
          <div className="container__block container__block--image2"></div>
          <div className="container__block container__block--image3"></div>
          <div className="container__block"></div>
      </div>




// CSS

.container{
  width: 1200px;
  height: 600px;
  margin: auto auto;
   background-color: red;
   display: grid;
  //replace the value we want to make dynamic with a var(--something, x) where x is a fallback if --something doesnt exist
  grid-template-columns: repeat(var(--column-count, 4), 1fr); 
  place-content: center;
   align-items: center;
   justify-content: center;
   justify-items: center;

   // use data attribute vales on the html to change the variable --something
   &[data-columns="2"]{
      --column-count: 2;
   }

   &[data-columns="3"]{
    --column-count: 3;
    }

    &[data-columns="4"]{
      --column-count: 4;
    }



   &__block{
    width: 200px;
    height: 200px;
    background-color: rebeccapurple;
    border: 1px solid white;
    background-size: cover;
    background-repeat: no-repeat;
    background-image: var(--selected-url);

        &--image1{
          --selected-url: url('https://source.unsplash.com/user/c_v_r')
        }

        &--image2{
          --selected-url: url('https://www.kimballstock.com/images/car-stock-photos.jpg')
        }

        &--image3{
          --selected-url: url('https://media.gettyimages.com/id/1636857191/photo/topshot-moto-prix-esp-catalunya-practice.jpg?s=2048x2048&w=gi&k=20&c=bt3AqEevYACDxkxf5Rom1MqE4bjHrMG2apxxTkmedJ8=')
        }


   }
 }
import UIKit

class CustomTableViewCell: UITableViewCell {
    var labelStackView: UIStackView!
    var innerView: UIView!
    var label: UILabel!

    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        setupInnerView()
        setupLabelStackView()
    }

    required init?(coder: NSCoder) {
        super.init(coder: coder)
        setupInnerView()
        setupLabelStackView()
    }
    
    private func setupInnerView() {
        
            innerView = UIView()
            innerView.translatesAutoresizingMaskIntoConstraints = false
            innerView.layer.borderWidth = 1.0 // 1-point border width
            innerView.layer.borderColor = UIColor.lightGray.cgColor // Border color
            
            contentView.addSubview(innerView)

            NSLayoutConstraint.activate([
                innerView.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: 10), // 8-point spacing from the left
                innerView.topAnchor.constraint(equalTo: contentView.topAnchor, constant: 6), // 8-point spacing from the top
                innerView.trailingAnchor.constraint(equalTo: contentView.trailingAnchor, constant: -10), // 8-point spacing from the right
                innerView.bottomAnchor.constraint(equalTo: contentView.bottomAnchor, constant: -6) // 8-point spacing from the bottom
            ])
        
        innerView.layer.cornerRadius = 13
        innerView.layer.borderColor = self.hexStringToUIColor(hex: "DCD8D8").cgColor
    }
    
    private func setupLabelStackView() {
        labelStackView = UIStackView()
        labelStackView.translatesAutoresizingMaskIntoConstraints = false
        labelStackView.axis = .vertical
        labelStackView.spacing = 8 // Adjust the vertical spacing between labels
        contentView.addSubview(labelStackView)

        NSLayoutConstraint.activate([
            labelStackView.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: 16),
            labelStackView.topAnchor.constraint(equalTo: contentView.topAnchor, constant: 16),
            labelStackView.trailingAnchor.constraint(equalTo: contentView.trailingAnchor, constant: -16),
            labelStackView.bottomAnchor.constraint(equalTo: contentView.bottomAnchor, constant: -16)
        ])
    }
    
    func setupLabels(labelData: [(String, UIImage, Int)]) -> ([UILabel], [UIImageView], [Int]) {
        
        var labels: [UILabel] = []
        var imageViews: [UIImageView] = []
        var tags: [Int] = []

        for (labelText, image, tag) in labelData {
            print("tagfkj : ", tag)
            let stackView = UIStackView()
            stackView.axis = .horizontal
            stackView.spacing = 8

            let imageView = UIImageView(image: image)
            imageView.contentMode = .scaleAspectFit
            imageView.widthAnchor.constraint(equalToConstant: 23).isActive = true
            imageView.heightAnchor.constraint(equalToConstant: 23).isActive = true
            imageView.tag = tag
            imageView.accessibilityIdentifier = "sewer"
            
            let label = UILabel()
            label.translatesAutoresizingMaskIntoConstraints = false
            label.text = labelText
            label.tag = tag
            
            stackView.addArrangedSubview(imageView)
            stackView.addArrangedSubview(label)

            labelStackView.addArrangedSubview(stackView)

            labels.append(label)
            imageViews.append(imageView)
            tags.append(tag)
        }

        return (labels, imageViews, tags)
    }
    
    func hexStringToUIColor (hex:String) -> UIColor {
        var cString:String = hex.trimmingCharacters(in: .whitespacesAndNewlines).uppercased()

        if (cString.hasPrefix("#")) {
            cString.remove(at: cString.startIndex)
        }

        if ((cString.count) != 6) {
            return UIColor.gray
        }

        var rgbValue:UInt64 = 0
        Scanner(string: cString).scanHexInt64(&rgbValue)

        return UIColor(
            red: CGFloat((rgbValue & 0xFF0000) >> 16) / 255.0,
            green: CGFloat((rgbValue & 0x00FF00) >> 8) / 255.0,
            blue: CGFloat(rgbValue & 0x0000FF) / 255.0,
            alpha: CGFloat(1.0)
        )
    }
}






func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {

  var imagesArray = ["circle_complete_icon", "circle_unsel"]()
            var textArray = ["jfdsk", "dfs"]()
            var tag = indexpath.row
            var idsArray = ["1","2"]()

      tag = indexPath.row
            print("tag43 : \(indexPath.row) ", tag)
            
            
            let cell = tableView.dequeueReusableCell(withIdentifier: "CustomTableViewCell", for: indexPath) as! CustomTableViewCell
            cell.selectionStyle = .none
            
            for subview in cell.labelStackView.arrangedSubviews {
                cell.labelStackView.removeArrangedSubview(subview)
                subview.removeFromSuperview()
            }
            
            var count = 0
            let labelsAndImagesForCell = textArray.enumerated().map { (index, labelText) -> (String, UIImage, Int) in
                let imageName = imagesArray[count]
                count += 1
                let image = UIImage(named: imageName) ?? UIImage()
                
                // Replace "UIImage()" with your default image if needed
                print("chk378: ", indexPath.row)
                return (labelText, image, tag)
            }
            
            let (labels, imageViews, tags) = cell.setupLabels(labelData: labelsAndImagesForCell)
            
            // Access and configure each label and image view individually
            var c = 0
            for (index, label) in (labels).enumerated() {
                label.text = labelsAndImagesForCell[index].0
                let labelTapGesture = UITapGestureRecognizer(target: self, action: #selector(subCategoryPressed(tagGesture: )))
                label.tag = tags[c]
                label.accessibilityIdentifier = idsArray[c]
                c += 1
                label.isUserInteractionEnabled = true
                label.addGestureRecognizer(labelTapGesture)
            }
            
            var c1 = 0
            for (index, imageView) in imageViews.enumerated() {
                imageView.image = labelsAndImagesForCell[index].1
                
                let tapGesture = UITapGestureRecognizer(target: self, action: #selector(subCategoryPressed(tagGesture: )))
                imageView.tag = tags[c1]
                imageView.accessibilityIdentifier = idsArray[c1]
                c1 += 1
                imageView.isUserInteractionEnabled = true
                imageView.addGestureRecognizer(tapGesture)
            }
            
            imagesArray = []
            textArray = []
            
            return cell
            
        }

const [scroll, setScroll] = useState(false);
 useEffect(() => {
   window.addEventListener("scroll", () => {
     setScroll(window.scrollY > 500);
   });
 }, []);

// Se implementa asi
<div className={scroll ? "box-buscador is--fixed" : "box-buscador"}>
        let parameters: [String:Any] = [
            "country" : "US",
            "type" : "custom",
            "capabilities": ["card_payments": ["requested": "true"], "transfers": ["requested": "true"]]]
            //"business_type": "individual",
//            "business_profile[url]": "https://google.com"]
        
        let url = "https://api.stripe.com/v1/accounts"
        let api_key = ""
        let loginData = api_key.data(using: String.Encoding.utf8)
        let base64LoginString = loginData?.base64EncodedString()
        print("key : ", (base64LoginString ?? "") as String)
        let headers: HTTPHeaders = ["Authorization": "Basic \(base64LoginString!)", "Content-Type": "application/x-www-form-urlencoded", "Accept": "*/*"]
        AF.request(url, method: .post, parameters: parameters, headers: headers)
            .responseJSON(completionHandler: { (response) in
                do {
                    let json = try JSON(data: response.data!)
                    print(json["id"])
                }
                catch let error {
                    print(error.localizedDescription)
                }
            })
star

Tue Apr 09 2024 01:30:23 GMT+0000 (Coordinated Universal Time)

#custom #properties
star

Wed Aug 02 2023 07:18:27 GMT+0000 (Coordinated Universal Time)

#ios #swift #cell #custom #customcell
star

Sat May 13 2023 05:57:46 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/44205000/how-to-add-class-in-element-on-scroll-react-js

#hooks #custom
star

Tue May 09 2023 12:47:44 GMT+0000 (Coordinated Universal Time) https://codesandbox.io/s/quirky-glade-brmwg6?file

#hooks #custom
star

Wed Nov 02 2022 16:30:52 GMT+0000 (Coordinated Universal Time) https://kuchbhilearning.blogspot.com/2022/11/add-custom-header-in-cloudfrontpass.html

#aws #cloudfront #custom #originrequest
star

Wed Oct 12 2022 03:02:35 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/20996104/how-to-change-panel-border-color

#panel #custom #border #draw
star

Tue Apr 05 2022 07:14:32 GMT+0000 (Coordinated Universal Time)

#ios #swift #custom #stripe #stripeconnect
star

Thu Aug 26 2021 03:10:25 GMT+0000 (Coordinated Universal Time) https://codepen.io/rooc/pen/bONbqw

#youtube #custom #playbutton #js
star

Thu Aug 26 2021 03:08:48 GMT+0000 (Coordinated Universal Time) https://codepen.io/arjunamgain/pen/zxydgg

##youyube #playbutton #custom #js

Save snippets that work with our extensions

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