Skip to content

Instantly share code, notes, and snippets.

View kartik-venugopal's full-sized avatar
😀

Kartik Venugopal kartik-venugopal

😀
View GitHub Profile
@NicholasBellucci
NicholasBellucci / ScrollingTextView.swift
Last active March 1, 2024 03:37
MacOS swift marquee scrolling text view
import Cocoa
open class ScrollingTextView: NSView {
// MARK: - Open variables
/// Text to scroll
open var text: NSString?
/// Font for scrolling text
open var font: NSFont?
@sooop
sooop / DragTableController.swift
Created February 9, 2017 06:07
NSTableView reordering row with drag and drop
//
// ViewController.swift
// DragTable
//
// Created by Anna Kim on 2017. 2. 9..
// Copyright © 2017년 Anna Kim. All rights reserved.
//
import Cocoa
@targodan
targodan / LICENSE
Last active December 20, 2023 13:39
Complementing code for my blog post "Decoding audio files with ffmpeg": https://www.targodan.de/post/decoding-audio-files-with-ffmpeg
The MIT License (MIT)
Copyright (c) 2016 Luca Corbatto
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
@usagimaru
usagimaru / NSImage+TintColor.swift
Last active October 12, 2023 13:39
NSImage+TintColor
import Cocoa
// This will work with Swift 5
extension NSImage {
func image(with tintColor: NSColor) -> NSImage {
if self.isTemplate == false {
return self
}
let image = self.copy() as! NSImage
@Serneum
Serneum / MediaApplication.swift
Last active March 8, 2024 04:59
Swift media key event handling
import Cocoa
class MediaApplication: NSApplication {
override func sendEvent(event: NSEvent) {
if (event.type == .SystemDefined && event.subtype.rawValue == 8) {
let keyCode = ((event.data1 & 0xFFFF0000) >> 16)
let keyFlags = (event.data1 & 0x0000FFFF)
// Get the key state. 0xA is KeyDown, OxB is KeyUp
let keyState = (((keyFlags & 0xFF00) >> 8)) == 0xA
let keyRepeat = (keyFlags & 0x1)
@bradjasper
bradjasper / gist:b2af4762756a5df20524
Created February 14, 2015 00:50
Build, Archive & Export Mac App from command line (rather than Xcode)
#!/bin/bash
BASE_DIR=$HOME/Projects/focus
BUILD_DIR=$BASE_DIR/Builds
FOCUS_ARCHIVE=$BUILD_DIR/Focus.xcarchive
FOCUS_APP=$BUILD_DIR/Focus.app
echo "Building Focus..."
echo "Cleaning up old archive & app..."
@iangmaia
iangmaia / ffmpegios.sh
Created September 29, 2012 17:05
Script to build ffmpeg for iOS
#ios 6.0 sdk and min version 4.3. No armv6 support. Tested with ffmpeg 0.8.X.
rm -r ./compiled
echo Configure for armv7 build
./configure \
--cc=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc \
--as='gas-preprocessor.pl /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc' \
--nm="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/nm" \
--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk \
--target-os=darwin \