Skip to content

Instantly share code, notes, and snippets.

@PierreJanineh
PierreJanineh / SocketDelegate.swift
Last active October 24, 2024 07:19
Connect to socket using Swift 5
protocol SocketDelegate: class {
/**
Called when `StreamDelegate` calls `stream(,eventCode)` with `.hasBytesAvailable` after all bytes have been read into a `Data` instance.
- Parameter result: `Data` result from InputStream.
*/
func socketDataReceived(result: Data?)
/**
Called when `StreamDelegate` calls `stream(,eventCode)` with `.hasBytesAvailable` after all bytes have been read into a `Data` instance and it was nil.
@icchan
icchan / RegexCardValidator.java
Last active May 16, 2024 04:13
Java Credit Card Number Validator
package net.bubblemix.cardcheck;
/**
* Validator for credit card numbers
* Checks validity and returns card type
*
* @author ian.chen
*/
public class RegexCardValidator {