Skip to content

Instantly share code, notes, and snippets.

View djrobby's full-sized avatar

Robby Dhillon djrobby

  • Detroit, MI - USA
View GitHub Profile
@Talha5
Talha5 / credit_card.rb
Created January 29, 2020 10:17
Ruby - Credit Card
class CreditCard
attr_accessor :card, :store
def initialize(card_identifier)
@card = card_identifier
@store = {
amex: {begins_with: ["34", "37"], number_length: ["15"]},
discover: {begins_with: ["6011"], number_length: ["16"]},
mastercard: {begins_with: ["51","52","53","54","55"], number_length: ["16"]},
visa: {begins_with: ["4"], number_length: ["13", "16"]},
@itsanan
itsanan / Services.swift
Last active June 22, 2020 17:46
Four basic functions of persistent storage (CRUD) with URLSession.
//
// Services.swift
// PlayingAPI
//
// Created by Anantya F on 29/11/19.
// Copyright © 2019 Anantya F. All rights reserved.
//
import Foundation
@Harry-Harrison
Harry-Harrison / ContentView.swift
Last active December 1, 2024 17:59
Haptic Feedback Vibrations in SwiftUI
// This prints a list of buttons that on tap will fire a different type of haptic vibration
import SwiftUI
struct ContentView: View {
let generator = UINotificationFeedbackGenerator()
var body: some View {
VStack(alignment: .center, spacing: 30.0) {
Button(action: {
@jbnunn
jbnunn / SignInView.swift
Last active January 23, 2025 12:09
SwiftUI + PhoneNumberKit implementation
import SwiftUI
import UIKit
import PhoneNumberKit
struct PhoneNumberTextFieldView: UIViewRepresentable {
@Binding var phoneNumber: String
private let textField = PhoneNumberTextField()
func makeUIView(context: Context) -> PhoneNumberTextField {
textField.withExamplePlaceholder = true
@douglascodes
douglascodes / glue_script.py
Last active January 6, 2021 18:56
AN AWS Glue script for remote debugging example
# For https://support.wharton.upenn.edu/help/glue-debugging
import uuid
from pyspark.sql.functions import *
from pyspark.sql.types import StringType, IntegerType, StructField, StructType
from awsglue.context import GlueContext
from awsglue.job import Job
from awsglue.utils import getResolvedOptions
import sys
from pyspark.context import SparkContext
import datetime
@sarpsolakoglu
sarpsolakoglu / CombineClient.swift
Created November 14, 2019 17:32
A simple Swift 5.1 REST client that uses combine
//
// CombineClient.swift
// CombineClient
//
// Created by Sarp Solakoglu on 14/11/2019.
// Copyright © 2019 Sarp Solakoglu. All rights reserved.
//
import Foundation
import Combine
import Combine
import Foundation
struct NamedURL: Codable {
let name: String
let url: URL
}
struct PokeAPIResponse: Codable {
let results: [NamedURL]
@mattt
mattt / UIViewControllerPreview.swift
Last active December 3, 2024 07:42
Generic structures to host previews of UIView and UIViewController subclasses.
import UIKit
#if canImport(SwiftUI) && DEBUG
import SwiftUI
struct UIViewControllerPreview<ViewController: UIViewController>: UIViewControllerRepresentable {
let viewController: ViewController
init(_ builder: @escaping () -> ViewController) {
viewController = builder()
}
@schwarzeni
schwarzeni / util.go
Last active February 24, 2025 02:57
[golang] get specific network interface's IPv4 address
package util
import (
"errors"
"fmt"
"net"
)
// useful links:
// https://stackoverflow.com/questions/27410764/dial-with-a-specific-address-interface-golang