Skip to content

Instantly share code, notes, and snippets.

View ofstudio's full-sized avatar

Oleg Fomin ofstudio

View GitHub Profile
@ofstudio
ofstudio / get_password.sh
Created December 14, 2014 16:39
Get password from OS X Keychain shell / bash function
# 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)
@ofstudio
ofstudio / djay2itunes.scpt
Last active August 29, 2015 14:03
Copy BPMs and Keys calculated in Algoriddim djay for Mac to iTunes meta tags
(*
** 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
@ofstudio
ofstudio / ieVersion.js
Created June 16, 2014 19:02
ieVersion.js - returns version of Internet Explorer
/**
*
* 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 () {
@ofstudio
ofstudio / defer-promise.js
Last active August 29, 2015 14:02
Javascript Deferred / Promise pattern
/**
* 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: