Skip to content

Instantly share code, notes, and snippets.

View gargs's full-sized avatar

Saurabh Garg gargs

View GitHub Profile
@gargs
gargs / Calendar.swift
Created October 20, 2023 14:26 — forked from mecid/Calendar.swift
SwiftUI Calendar view using LazyVGrid
import SwiftUI
extension Calendar {
func generateDates(
inside interval: DateInterval,
matching components: DateComponents
) -> [Date] {
var dates: [Date] = []
dates.append(interval.start)
import SwiftUI
public struct UnderlinedPasswordTextFieldStyle: TextFieldStyle {
private var text: Binding<String>
@State private var isShowingPassword = false
@Environment(\.displayScale) private var displayScale
public init(text: Binding<String>) {
self.text = text
}

Keybase proof

I hereby claim:

  • I am gargs on github.
  • I am gargs (https://keybase.io/gargs) on keybase.
  • I have a public key ASA-QlHBsPa85av6WO21OQaV_icnXC9GYTKs8O4zTvvSmQo

To claim this, I am signing this object:

@gargs
gargs / PauseSpotify.scpt
Created December 13, 2010 16:23
Applescript to pause Spotify. Could be used with Quicksilver
tell application "System Events"
set MyList to (name of every process)
end tell
tell application "System Events"
set AppList to name of application processes whose frontmost is true
end tell
set ActiveApp to item 1 of AppList
static NSString * const AQPerThreadManagedObjectContext = @"AQPerThreadManagedObjectContext";
void StoreManagedObjectContextForCurrentThread( NSManagedObjectContext * context )
{
[[[NSThread currentThread] threadDictionary] setObject: context forKey: AQPerThreadManagedObjectContext];
}
NSManagedObjectContext * PerThreadManagedObjectContext( void )
{
NSManagedObjectContext * result = [[[NSThread currentThread] threadDictionary] objectForKey: AQPerThreadManagedObjectContext];