Skip to content

Instantly share code, notes, and snippets.

View norio-nomura's full-sized avatar

Norio Nomura norio-nomura

View GitHub Profile
@norio-nomura
norio-nomura / audioVolume.js
Created August 19, 2014 05:45
Restore/Save Audio Volume
javascript:$.getScript('//cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.min.js', function(){
audioVolume = $.cookie('audioVolume');
$('audio').each(function(){
if (audioVolume) {
this.player.setVolume(audioVolume);
}
$(this).on('volumechange', function(){
$.cookie('audioVolume', this.player.getVolume(), {expires: 100, path: '/'});
});
});
@norio-nomura
norio-nomura / SampleBufferDisplayLayerView.swift
Last active April 5, 2017 07:39
AVSampleBufferDisplayLayerを使う
//
// SampleBufferDisplayLayerView.swift
// SampleBufferDisplayLayer
//
import UIKit
import AVFoundation
class SampleBufferDisplayLayerView: UIView {
"NSBadge1&2",
"NSBadge3",
"NSBadge4",
"NSBadge5",
"NSBottomBevel",
"NSBottomLeftCorner",
"NSBottomLeftCornerMask",
"NSBottomRightCorner",
"NSBottomRightCornerMask",
"NSClosedHandCursor",
@norio-nomura
norio-nomura / AVPlayerLayer.swift
Last active January 5, 2016 20:52
PlaygroundでAVPlayerLayer
// Require "Run in Full Simulator" in Playground Settings.
// On first execution, iOS Simulator will show request authorization for Photo Library.
// Only a video without audio track can be played.
import UIKit
import AVFoundation
import Photos
import XCPlayground
class PLayerView: UIView {
@norio-nomura
norio-nomura / printExcludedFromBackup.swift
Created November 17, 2014 10:59
NSURLIsExcludedFromBackupKeyがtrueなものをリストアップする
#!/usr/bin/env xcrun swift
import Cocoa
extension NSURL {
var isDirectory: Bool {
return resourceValue(NSURLIsDirectoryKey)
}
var isExcludedFromBackup: Bool {
return resourceValue(NSURLIsExcludedFromBackupKey)
@norio-nomura
norio-nomura / setExcludedFromBackupToCaches.swift
Created November 20, 2014 12:31
指定したディレクトリ以下の名前がCachesなサブディレクトリにNSURLIsExcludedFromBackupKey属性を設定するスクリプト
#!/usr/bin/env xcrun swift
import Cocoa
extension NSURL {
var isDirectory: Bool {
return resourceValue(NSURLIsDirectoryKey)
}
var isExcludedFromBackup: Bool {
return resourceValue(NSURLIsExcludedFromBackupKey)
@norio-nomura
norio-nomura / patch.diff
Created December 28, 2014 14:29
AVMutableComposition使う必要ないのでは?
diff --git a/SimpleGaplessPlayer/HKLGaplessPlayer/AssetReaderFragment.swift b/SimpleGaplessPlayer/HKLGaplessPlayer/AssetReaderFragment.swift
index 9fdd89d..2d41bf4 100644
--- a/SimpleGaplessPlayer/HKLGaplessPlayer/AssetReaderFragment.swift
+++ b/SimpleGaplessPlayer/HKLGaplessPlayer/AssetReaderFragment.swift
@@ -121,7 +121,7 @@ internal class AssetReaderFragment: NSObject {
// 注意点:
// - このビデオトラックにはコンポジション上のビデオトラックを指定すること
// - IOSurfaceで作成しなくても再生できるが、念のため付けておく
- let compoVideoTracks = composition.tracksWithMediaType(AVMediaTypeVideo)
+ let compoVideoTracks = asset.tracksWithMediaType(AVMediaTypeVideo)
@norio-nomura
norio-nomura / indexof.asm
Last active August 29, 2015 14:13
swift-demangle-filter.py -g indexof.swift -o indexof.asm
.section __TEXT,__text,regular,pure_instructions
.section __DWARF,__debug_info,regular,debug
Lsection_info:
.section __DWARF,__debug_abbrev,regular,debug
Lsection_abbrev:
.section __DWARF,__debug_aranges,regular,debug
.section __DWARF,__debug_macinfo,regular,debug
.section __DWARF,__debug_line,regular,debug
Lsection_line:
.section __DWARF,__debug_loc,regular,debug
@norio-nomura
norio-nomura / indexof-O.sil
Created January 15, 2015 01:55
`swift-demangle-filter.py -emit-sil -O indexof.swift -o indexof-O.sil`
This file has been truncated, but you can view the full file.
sil_stage canonical
import Builtin
import Swift
import SwiftShims
// indexof.a : Swift.Array<Swift.Int>
sil_global indexof.a : [Swift.Int] : $Array<Int>
// indexof.c (Swift.Int) -> Swift.Bool
@norio-nomura
norio-nomura / indexof.sil
Last active August 29, 2015 14:13
`swift-demangle-filter.py -emit-sil indexof.swift -o indexof.sil`
sil_stage canonical
import Builtin
import Swift
import SwiftShims
// indexof.a : Swift.Array<Swift.Int>
sil_global indexof.a : [Swift.Int] : $Array<Int>
// indexof.c (Swift.Int) -> Swift.Bool