This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#change some specific application's interface language | |
defaults write com.google.Chrome AppleLanguages "(zh_CN,en_US)" | |
defaults write com.apple.iWork.Pages AppleLanguages "(zh_CN,en_US)" | |
defaults write com.apple.Aperture AppleLanguages "(zh_CN,en_US)" | |
#change all applications' interface language, don't recommend. | |
defaults write NSGlobalDomain AppleLanguages "(en_US,zh_CN)" | |
defaults write NSGlobalDomain AppleLanguages "(zh_CN,en_US)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// from http://scratch99.com/web-development/javascript/convert-bytes-to-mb-kb/ | |
function bytesToSize(bytes) { | |
var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB']; | |
if (bytes == 0) return 'n/a'; | |
var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024))); | |
if (i == 0) return bytes + ' ' + sizes[i]; | |
return (bytes / Math.pow(1024, i)).toFixed(1) + ' ' + sizes[i]; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript | |
Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
@UIApplicationMain | |
class AppDelegate: UIResponder, UIApplicationDelegate { | |
var window: UIWindow? | |
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { | |
let viewController = SplitVc() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func pauseAnimation(){ | |
var pausedTime = layer.convertTime(CACurrentMediaTime(), fromLayer: nil) | |
layer.speed = 0.0 | |
layer.timeOffset = pausedTime | |
} | |
func resumeAnimation(){ | |
var pausedTime = layer.timeOffset | |
layer.speed = 1.0 | |
layer.timeOffset = 0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
class FloatingButtonController: UIViewController { | |
private(set) var button: UIButton! | |
required init?(coder aDecoder: NSCoder) { | |
fatalError() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
This code will translate page contents automatically (without user input) | |
Settings located at line 9, current script will translate english to estonian | |
--> | |
<style>#google_translate_element,.skiptranslate{display:none;}body{top:0!important;}</style> | |
<div id="google_translate_element"></div> | |
<script> | |
function googleTranslateElementInit() { | |
new google.translate.TranslateElement({pageLanguage: 'en', includedLanguages: 'et', autoDisplay: false}, 'google_translate_element'); | |
var a = document.querySelector("#google_translate_element select"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function asyncFunc(e) { | |
return new Promise((resolve, reject) => { | |
setTimeout(() => resolve(e), e * 1000); | |
}); | |
} | |
const arr = [1, 2, 3]; | |
let final = []; | |
function workMyCollection(arr) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#EXTM3U | |
#EXTINF:-1 tvg-id="BBC One HD" tvg-name="BBC One HD" tvg-logo="https://s4.postimg.org/k5xl5dmf1/bbc_one.png" group-title="BBC",BBC One HD | |
http://a.files.bbci.co.uk/media/live/manifesto/audio_video/simulcast/hls/uk/abr_hdtv/ak/bbc_one_hd.m3u8 | |
#EXTINF:-1 tvg-id="BBC One London" tvg-name="BBC One London" tvg-logo="https://s4.postimg.org/z61nj8qd9/Bbc_london_logo.jpg" group-title="BBC",BBC One London | |
http://a.files.bbci.co.uk/media/live/manifesto/audio_video/simulcast/hls/uk/hls_tablet/ak/bbc_one_london.m3u8 | |
#EXTINF:-1 tvg-id="BBC One Northern Ireland HD" tvg-name="BBC One Northern Ireland HD" tvg-logo="https://s3.postimg.org/ltztuojqr/6y_QROLCn_400x400.png" group-title="BBC",BBC One Northern Ireland HD | |
http://a.files.bbci.co.uk/media/live/manifesto/audio_video/simulcast/hls/uk/abr_hdtv/ak/bbc_one_northern_ireland_hd.m3u8 | |
#EXTINF:-1 tvg-id="BBC One Scotland HD" tvg-name="BBC One Scotland HD" tvg-logo="https://s3.postimg.org/ltztuojqr/6y_QROLCn_400x400.png" group-title="BBC",BBC One Scotland HD | |
http://a.fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// updated for Swift 3 | |
import Carbon | |
// Swift version of https://developer.apple.com/library/mac/technotes/tn2084/_index.html | |
@IBAction func testButtonPushed(sender: AnyObject) { | |
guard let url = NSBundle.main.url(forResource: "SendFinderMessage", withExtension: "scpt") else { | |
return | |
} |
OlderNewer