Skip to content

Instantly share code, notes, and snippets.

@SheffieldKevin
SheffieldKevin / movietracks.swift
Last active November 7, 2020 14:47
Playing with movie tracks using AVFoundation in Swift (command line version)
#!/usr/bin/env swift
import Foundation
import AVFoundation
if Process.arguments.count != 2 {
println("The first and only argument should be a full path to a movie or music file.")
exit(1)
}
@mathieucarbou
mathieucarbou / jquery.xdomain.js
Created July 29, 2011 23:45
jQuery CORS Plugin - transparently add CORS support for IE8+ in jQuery using XDomainRequest. Support cookies.
PROJECT MOVED TO https://github.com/Ovea/cors
/**
* https://gist.github.com/1114981
*
* By default, support transferring session cookie with XDomainRequest for IE. The cookie value is by default 'jsessionid'
*
* You can change the session cookie value like this, before including this script:
*
* window.SESSION_COOKIE_NAME = 'PHP_SESSION';
@zachloubier
zachloubier / youtube_next.applescript
Created December 3, 2015 01:05
Scripts for controlling YouTube videos. Inspiration taken from https://gist.github.com/fent/7763775
# Next Youtube Video in Playlist
tell application "Google Chrome"
repeat with t in tabs of windows
tell t
if URL starts with "http://www.youtube.com/watch" or URL starts with "https://www.youtube.com/watch" then
execute javascript "
var player = document.getElementById('movie_player') || document.getElementsByTagName('embed')[0];
if (player) {
document.getElementsByClassName('ytp-next-button')[0].click()
@fent
fent / youtube_next.applescript
Last active May 13, 2022 00:49
Scripts for controlling youtube videos. Now maintained at https://github.com/fent/dotfiles/tree/master/scripts
# If in a playlist, play the next video.
tell application "Google Chrome"
repeat with t in tabs of windows
tell t
if URL starts with "http://www.youtube.com/watch" or URL starts with "https://www.youtube.com/watch" then
execute javascript "
var player =
document.getElementById('movie_player') ||
document.getElementsByTagName('embed')[0];
var next = document.getElementsByClassName('yt-uix-button-icon-playlist-bar-next')[0];
@lukaskubanek
lukaskubanek / NSView Drawing Issue on macOS Big Sur.md
Last active July 18, 2022 08:09
NSView Drawing Issue on macOS Big Sur

This is an excerpt from our internal documentation describing an issue with drawing in NSViews on macOS Big Sur.

1️⃣ Introduction

In macOS Big Sur (probably starting with β9), Apple changed the default contents format for backing layers of NSViews. Instead of an explicit CALayerContentsFormat.RGBA8Uint value, an „Automatic“ value is now used. Even though it also resolves into „RGBA8“ in our testing, it has some serious implications as it breaks assumptions our code relies on.

I first stumbled upon this issue in this tweet by Frank. It links to a thread on Apple Forums by Mark that contains valuable information as well as ideas for workarounds. The changed behavior was also confirmed by Marcin in this tweet.

2️⃣ Impact on Diagrams

@mackuba
mackuba / wwdc15.md
Last active August 6, 2022 17:28
New stuff from WWDC 2015

Here's my own list of the interesting stuff announced during this year's WWDC, collected from the keynotes, various Apple docs, blog posts and tweets.

If you're planning to watch the videos, I really recommend this Mac app that helps you download and watch them: https://github.com/insidegui/WWDC.

OS X El Capitan

http://www.apple.com/osx/elcapitan-preview/

  • split view - two apps side by side on full screen
@jwilling
jwilling / gist:4186817
Last active March 5, 2023 22:01
Lets help improve AppKit.

Is AppKit causing you frustration? Instead of just complaining about it, lets try to make it better by compiling a list of specific problems with AppKit. Leave a comment below, and I'll include it in the list.


##NSView##

  • NSView does not have the ability to set an affine transform (rdar://15608609)
  • Controls that have cells (such as NSTextField) do not respond properly when layer-backed. Take NSButton as an example. When not layer-backed, it will animate properly using the animator proxy. When layer-backed, using the animator proxy breaks focus rings (they jump to destination immediately). Currently, directly manipulating the layer of a cell-based control is not supported (and will lead to a broken interface), but is much needed. (rdar://15608822)

##NSViewController##

  • NSViewController could be more useful. It has -loadView but no other lifecycle methods. (rdar://15608948)
REMOTE REQUESTS:
com.sadun.airflick
RequestType := show-photo | play-media | screenshot
MediaLocation :=
<url string> | <local file path string> | <array of local file path strings for slideshow>
Rotation := 0 | 1 | 2 | 3 (0 ^, 1 <, 2 v, 3 >)
Transition := SlideRight | Dissolve
SlideDuration := 2 | 3 | 5 | 8 | 10 (Use strings. Incorrect durations default to 5)
// Single Slide
@raphaelhanneken
raphaelhanneken / NSImageExtensions.swift
Last active August 24, 2023 01:04
NSImage extensions for easy resizing, cropping and saving png images.
//
// NSImageExtensions.swift
//
import Cocoa
extension NSImage {
/// The height of the image.
var height: CGFloat {
@HarryUPf
HarryUPf / README.md
Last active September 28, 2023 01:37
Raspberry Pi SunVox Headless Synth (in 10 easy steps)

Raspberry Pi SunVox Headless Synth Setup (in 10-easy-steps)

INSTRUCTIONS

STEP_01

STEP_02

  • write the extracted .img to sdcard with Etcher

STEP_03