Skip to content

Instantly share code, notes, and snippets.

View simrandotdev's full-sized avatar

Simran simrandotdev

View GitHub Profile
{
"recentlyPlayedEpisodes": [{
"title": "Enabled Play for everyone with Alex Dunn",
"pubDate": "2022-06-23 21:00:00",
"link": "https://www.hanselminutes.com/",
"guid": "da1fc5cf-6b28-404b-b733-5a34d70fcd1f",
"author": "scott@hanselman.com (Scott Hanselman)",
"thumbnail": "https://image.simplecastcdn.com/images/e464c34b-2f32-411b-bdd2-dcf02e5301eb/c4810f0e-6832-4e5a-a754-f5ad93db86b4/3000x3000/846.jpg?aid=rss_feed",
"description": "\n<p>Enabled Play helps people turn anything into a new input for their computers, game consoles, and more. Powered by offline, private, and personalized Artificial Intelligence and distributed services – all packed into affordable devices and apps. Imagine playing Elden Ring with just your facial expressions! Or enabling keyboards, mice, and game pads with whatever devices will best set you up for success. Enabled Play enable folks with disabilities, different levels of abilities, basically everyone to be their best selves on any device. Scott talks to Alex Du
function sortByProperty(property) {
var sortOrder = 1;
if(property[0] === "-") {
sortOrder = -1;
property = property.substr(1);
}
return function (a,b) {
/* next line works with strings and numbers,
* and you may want to customize it to your needs
*/
@simrandotdev
simrandotdev / getDependentPicklists.cls (2017 approach)
Created March 25, 2022 12:57 — forked from boxfoot/getDependentPicklists.cls (2017 approach)
Handle cases where one dependent option can be used for multiple controlling options
/*
* Apex doesn't expose dependent picklist info directly, but it's possible to expose.
* Approach:
* * Schema.PicklistEntry doesn't expose validFor tokens, but they are there, and can be accessed by serializing to JSON
* (and then for convenience, deserializing back into an Apex POJO)
* * validFor tokens are converted from base64 representations (e.g. gAAA) to binary (100000000000000000000)
* each character corresponds to 6 bits, determined by normal base64 encoding rules.
* * The binary bits correspond to controlling values that are active - e.g. in the example above, this dependent option
* is available for the first controlling field only.
*
@simrandotdev
simrandotdev / LOTR.swift
Created July 13, 2021 18:37
LOTR token in Header example
import UIKit
var request = URLRequest(url: URL(string: "https://the-one-api.dev/v2/movie")!)
request.addValue("Bearer <Replace this with your Token for the API>", forHTTPHeaderField: "Authorization")
URLSession.shared.dataTask(with: request) { data, response, error in
guard error == nil,
let data = data else {
print(error)
return
@simrandotdev
simrandotdev / nitnem.json
Created January 6, 2021 21:38
XL Gurbani Apps Nitnem
[
{
"title": "Japji Sahib",
"image": "https://firebasestorage.googleapis.com/v0/b/xl-gurbani-server.appspot.com/o/JapjiSahib.png?alt=media",
"track": "https://punjabicloud.com/play.php?q=ywbtFzu8gYc.mp3"
},
{
"title": "Japji Sahib",
"image": "https://firebasestorage.googleapis.com/v0/b/xl-gurbani-server.appspot.com/o/JapjiSahib.png?alt=media",
"track": "https://punjabicloud.com/play.php?q=ywbtFzu8gYc.mp3"
@simrandotdev
simrandotdev / airports.json
Last active February 24, 2021 02:40 — forked from tdreyno/airports.json
JSON data for airports and their locations
[{
"code": "DEL",
"lat": "28.5603",
"lon": "77.1027",
"name": "Indira Gandhi International Airport",
"city": "New Delhi",
"state": "Madhya Pradesh",
"country": "India"
},
{
@simrandotdev
simrandotdev / SwiftViperBoilerPlate.swift
Created December 17, 2020 02:22
Swift Viper boiler plate
//
// HomeViewBuilder.swift
// Viper_Basic_Slider
//
// Created by jc on 2020-12-16.
//
import UIKit
// view
@simrandotdev
simrandotdev / CarrierInfo.swift
Created September 22, 2020 22:25 — forked from dfelber/CarrierInfo.swift
Get carrier info from your iOS Device
import CoreTelephony
let info: CTTelephonyNetworkInfo = CTTelephonyNetworkInfo()
guard let carrier: CTCarrier = info.subscriberCellularProvider else {
// No carrier info available
return
}
print(carrier.carrierName)
print(carrier.mobileCountryCode)
import UIKit
import Foundation
func loadData() {
do {
guard let url = URL(string: "https://reqres.in/api/users/1") else { return }
var request = URLRequest(url: url)
request.httpMethod = "DELETE"