Skip to content

Instantly share code, notes, and snippets.

@dostanko
dostanko / sudo ask pass source redefinition, MacOS
Last active December 12, 2015 09:38
bash script asks user to enter password in Finder window to do some root actions (it was useful for me in xCode project prebuilt script)
TITLE="Please, enter root password"
DIALOG="display dialog \"$@\" default answer \"\" with title \"$TITLE\""
DIALOG="$DIALOG with icon caution with hidden answer"
result=`osascript -e 'tell application "Finder"' -e "activate" -e "$DIALOG" -e 'end tell'`
export SUDO_ASKPASS="$result" | sed -e 's/^text returned://' -e 's/, button returned:.*$//'
gem list --local compass| grep -q compass
COMPASS_INSTALLED=$?
# Default build dir
UFW_BUILD_DIR="./build"
# Global vars
#if [ ! -z ${BUILD_DIR} ]; then
## Use the build dir specified by XCode
# UFW_BUILD_DIR="${BUILD_DIR}"
#fi
@dostanko
dostanko / Ajax request interceptor for ExtJS
Created June 7, 2013 13:05
This code allows to intercept ajax requests in Sencha application. It's good base to emulate all the backend for JavaScript client, make it dynamic, add intellect to it, response with delay, and do not touch application code at all. Just include this and relative code.
Ext.require(["Ext.data.JsonP", "Ext.Ajax", "Ext.util.DelayedTask", "Localresponse.response"], function(){
Ext.merge(Ext.Ajax , {
request: function(params){
var serviceId = params.url.match( /\/([^\/\?]+)?\?/ ).pop().split("-").join("_");;
if (undefined !== Localresponse.responses[serviceId]) {
var delay = 500;
if (undefined !== Localresponse.responses[serviceId + "_delay"]) {
delay = Localresponse.responses[serviceId + "_delay"].call();
};