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
/** | |
* A simple workaround on Deferred / Promise pattern | |
* with result caching and multiply actions on success / fail | |
* | |
* defer() returns methods: | |
* resolve(data) - request is successfully resolved (returns nothing) | |
* reject(msg) - request if failed (returns nothing) | |
* promise() - returns promise function | |
* | |
* promise() returns methods: |
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
/** | |
* | |
* Returns the version of Internet Explorer | |
* or undefined if no Internet Explorer detected | |
* Tested in IE8 ... IE11 | |
* | |
* http://stackoverflow.com/a/20815285/3071651 | |
* | |
*/ | |
function ieVersion () { |
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 SCRIPT IS OUTDATED ** | |
Check https://github.com/ofstudio/djay2itunes.js for new version | |
djay2itunes.scpt | |
Description: Copy BPMs and Keys calculated in Algoriddim djay for Mac to iTunes meta tags | |
Version: 0.0.1 / July 2014 |
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
# Get password from OS X Keychain function | |
# Replace %ACCOUNT_NAME% with account name of Keychain item | |
# See `man security` for more info | |
get_pw () { | |
security 2>&1 >/dev/null find-generic-password -ga "%ACCOUNT_NAME%" \ | |
| sed 's/password: "\(.*\)"/\1/' | |
} | |
# Don't store server credentials in plain text! | |
PASS=$(get_pw) |
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
/** | |
* Example of file / folders scripting in OS X with Javascript | |
* Open /Applications/Script Editor.app, paste the code and click Run button | |
* | |
* @author Oleg Fomin <[email protected]> | |
* | |
*/ | |
function file_exists(name) { | |
try { |
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
/** | |
* Example of dialogs / notifications scripting in OS X with Javascript | |
* Open /Applications/Script Editor.app, paste the code and click Run button | |
* | |
* @author Oleg Fomin <[email protected]> | |
* | |
*/ | |
var result, | |
my_app = Application.currentApplication(); |
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
/** | |
* Example of iTunes scripting in OS X with Javascript | |
* Open /Applications/Script Editor.app, paste the code and click Run button | |
* | |
* @author Oleg Fomin <[email protected]> | |
* | |
*/ | |
var my_app = Application.currentApplication(), | |
itunes = new Application('iTunes'), |
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
<!-- Скрипт транслитерации --> | |
<script> | |
function translate(str) { | |
function strtr(s, replacePairs) { | |
"use strict"; | |
var str = s.toString(), key, re; | |
for (key in replacePairs) { | |
if (replacePairs.hasOwnProperty(key)) { | |
re = new RegExp(key, "g"); |
OlderNewer