Skip to content

Instantly share code, notes, and snippets.

View simrandotdev's full-sized avatar

Simran simrandotdev

View GitHub Profile
@kevinahn7
kevinahn7 / Urlify
Created December 13, 2018 19:10
Question from CtCI
let test = "Mr John Smith ";
function urlify(string) {
let stringArray = string.split(" ");
let filteredArray = stringArray.filter(x => x != "")
let newFilteredArray = filteredArray.join(" ").split("")
for (let x = 0; x < newFilteredArray.length; x++) {
if (newFilteredArray[x] === " ") {
newFilteredArray[x] = "%20"
@barbietunnie
barbietunnie / udemy-courses-download-using-cookies.md
Last active June 12, 2025 07:04
Downloading Udemy videos with youtube-dl

How to download your Udemy course videos using youtube-dl

$ youtube-dl --list-extractors | grep udemy

Steps

  1. Get link to the course to download. e.g. https://www.udemy.com/course-name/
  2. Login into udemy website, save the cookie from chrome using Chrome (Cookie.txt)[1] export extension. Save it to file udemy-cookies.txt
  3. Get the link of the video that you want to download. usually in format. Use the command provided below where you have to replace the {course_link} and {path_to_cookies_file} with respective paths.
$ youtube-dl {course_link} --cookies {path_to_cookies_file}
@dfelber
dfelber / CarrierInfo.swift
Created June 14, 2016 14:53
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)
@hoop4848
hoop4848 / Um What?
Created May 29, 2015 21:35
My First - WTF am I even doing?
#include <string>
using namespace std;
int main(){
cout << "If someone sees this, I have no idea what I'm even doing..." << endl;
return (0);
}
@staltz
staltz / introrx.md
Last active July 31, 2025 06:33
The introduction to Reactive Programming you've been missing
@boxfoot
boxfoot / getDependentPicklists.cls (2017 approach)
Last active May 22, 2025 09:31
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.
*