The best place to ask programming/development questions, imo. UPDATE: stackoverflow is the *worst* place to *ask* questions (if your first question/comment doesn't get any up-rating/response, then u can't ask anymore questions--ridiculously unrealistic), but a great reference for finding answers.

My Music (Nickleus)

20160607

[SOLVED] mac osx el capitan: customize menubar clock date & time (hack)

/////////////// SETTING THE OSX MENUBAR DATE & TIME; based on: http://apple.stackexchange.com/a/182435/156582

TERMINAL TAB 1

$ cd

$ nano -w setClock.sh

#!/bin/bash
killall -KILL SystemUIServer
while true
do
        defaults write com.apple.menuextra.clock "DateFormat" "EEEE' 'y.MM.dd' 'HH:mm:ss' 'z' ''week:'' 'ww"
done

$ chmod +x setClock.sh

[START]

$ ./setClock.sh


TERMINAL TAB 2

IF the menubar clock reappears w incorrect desired display format, run:

$ killall -KILL SystemUIServer

repeat (back to [START]) until the clock renders properly. it sometimes takes several attempts.

ELSE, stop the script:


TERMINAL TAB 1

ctrl-c (stop the "while" loop)

///////////////


NOTE about the DateFormat value string:

"EEEE' 'y.MM.dd' 'HH:mm:ss' 'z' ''week:'' 'ww"

spaces seem to need to b surrounded by single quotes ' ', as did week since w was getting interpreted as smth else.

it will render like this:



NOTE 2: this unfortunately doesn't persist thru reboots or logging out (but it does persist if u lock the screen then log back in again), but i don't normally turn off my macbook so.. please tell me if u hav corrections or tips or improvements or new info :)

20160531

[SOLVED] php+jquery page loading twice (2 GET requests) instead of once

i was using jquery to set an element's css background-image inside $(document).ready(function()... , and when i removed that code th page would load once instead of twice:

var url = el.data("imgbg");  // get the url string
el.css("background-image", "url('"+url+"')");  // set bgimg url

what was causing the extra page reload/GET request was an empty url string!

putting a simple if-test on url fixed it:

if (url != "") el.css("background-image", "url('"+url+"')");

:)

my fiddle confirming this behavior:

20160411

jquery how to get this selector as string in event handler/listener

This won't show you the DOM path, but it will output a string representation of what you see in eg chrome debugger, when viewing an object.




    $('.mybtn').click( function(event){
    console.log("%s", this);   // output: "button.mybtn"
    });

https://developer.chrome.com/devtools/docs/console-api#consolelogobject-object

20160322

PHP INCLUDE/REQUIRE PATH SCHEME

a path-include/require-scheme that will work everywhere.
paths can b copied to any file n will work, w/o needing to b changed--
as long as the __ROOT__ variable is properly configured at the top of the file u paste into :)