About This Site I suppose this is my blog. I consider this more like my personal notes on web development versus a blog. Anyway, I thought that some of this may be of value to other web application developers out there, so enjoy, and hopefully something I have posted here will save you some time.
|
" vim 7.x specific
" set to be more vim like
set nocompatible
" check paths for .ros alternatives
set includeexpr=substitute(v:fname,'$','.ros','g')
" hide buffers when they go away with :bd
set hidden
" set tabs
set expandtab
set tabstop=4
set shiftwidth=4
set autoindent
set cindent
" window management
set number
set ruler
set showmode
set laststatus=2
set history=500
set cursorline
au WinLeave * set nocursorline
au WinEnter * set cursorline
" search
set incsearch
set hlsearch
set smartcase
" colors
syntax on
colorscheme desert
set showmatch
au BufRead,BufNewFile *.ros set filetype=php
au BufRead,BufNewFile *.js.ros set filetype=javascript
au BufRead,BufNewFile *.css.ros set filetype=css
highlight Comment ctermfg=6
highlight Folded ctermfg=7 ctermbg=0
highlight LineNr ctermfg=6 ctermbg=0
" misc
set title
set sc
" use wildmenu
set wildmenu
set wildmode=list:longest,full
set wildignore+=*.0,*.class,*.pyc,*.pyo,*/CVS/,*.jar
" turn word wrap off
set nowrap
" get the backup files in ~/.tmp/
"#set backupdir=~/.tmp/
"set directory=~/.tmp/
" folding
set foldmethod=marker
" If I remember correctly this makes C-k look up things in php_doc
set keywordprg=/[path to]/php_doc
" hide the mouse while typing
set mousehide
This .screenrc has a bunch of commented out lines that I don’t use, but I know if I delete them, I will need them for some reason and wish I didn’t.
# Use CTRL-<space> as the escape sequence instead of CTRL-A
# this seems to only work on certain machines
escape '^@^@'
# Use ` as the escape sequence instead of CTRL-A
#escape ``
# Once you learn to use the screen scrollback, you'll never scroll in terminal again!
defscrollback 20000
# Aesthetic Stuff
vbell off
hardstatus alwayslastline
hardstatus string "%{gk}[ %{G}%H %{g}][%= %{wk}%?%-Lw%?%{r}(%{W}%n*%f %t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %m/%d %{W}%c %{g}]"
#hardstatus string '%{= kc}%H%{g} %{kw}%?%-Lw%?%{W}%n%f%t%?(%u)%?%{w}%?%+Lw%?%=%{c}%m/%d %C %{w}%l%'
#hardstatus string '%{= cK}%-Lw%{= KW}%50>%n%f* %t%{= cK}%+Lw%< %{= kG}%-=%D %d %M %Y %c:%s%{-}'
#hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f %t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %m/%d %{W}%c %{g}]'
# Rebind PuTTY <C-?> (127) backspace to <C-H>
bindkey -k kD stuff ^H
# Rebind PuTTY <del> to <right><backspace>
#bindkey "^[[3~" stuff ^[OC^H
term xterm-color
setenv SCREEN_TERM screen
startup_message off
#termcapinfo xterm Z0=\E[?3h:Z1=\E[?3l:is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;4;6l
#termcapinfo xterm-color Z0=\E[?3h:Z1=\E[?3l:is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;4;6l
Sorry, this has to be edited for security reasons…
Host [hostname1] [hostname2] [hostname3]
ProxyCommand ssh [hostname] /usr/local/bin/nc -w 5 %h %p
Host [hostname1] [hostname2] [hostname3]
Compression yes
# defaults
Host *
Protocol 2,1
PubkeyAuthentication yes
RSAAuthentication yes
PasswordAuthentication yes
PreferredAuthentications publickey,password,keyboard-interactive
ForwardAgent yes
ForwardX11 no
ServerAliveCountMax 3
ServerAliveInterval 600
Host [hostname]
HostName [ip address]
Port [port number]
User [username]
.bash_profile, .profile, .bash_rc …
if [ "$PS1" != "" ]; then
PROMPT_COMMAND='echo -ne "\033]0;${HOSTNAME}: ${PWD}\007"'
PS1="[\e[1;33m\u::${HOSTNAME} \t\[\e[1;35m\e[0m\]]$ "
fi
alias ls='ls -G'
alias ll='ls -l'
alias la='ll -a'
alias env='env | sort'
alias ..='cd ..'
alias :e=vim
alias grepr='grep -rHn'
# finds and removes the ._ files that textmate creates
alias findmatefiles='find . -name ._*'
alias rmmatefiles='find . -name ._* -exec rm {} \;'
export DEVROOT=~/dev/
export HISTFILE=$HOME/.bash_history
export HISTSIZE=5000
export PATH=$HOME/bin:/Applications/MAMP/bin:/Applications/MAMP/Library/bin:/home/y/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/home/y/sbin:/sbin:/usr/sbin:/usr/local/sbin:/usr/local/mysql/bin:.
export GREP_OPTIONS='--color=auto'
setenv () { export $1="$2"; }
unsetenv () { unset $*; }
The app: http://psyjinx.com/iphone/
This is a very simple webapp. It displays images that iPhones and iPod Touches can use as wallpaper. There isn’t really a need for offline use with the iPhone, but the iPod Touch could benefit from it. It took me about 10 minutes to learn what to do, and implement it for full offline use. The key to making a web app work offline is to add a manifest file.
Continue reading Example of an offline web app »
Ever needed to convert a video from one format to another? I needed to convert a flv to a mp4 yesterday and found that there were lots of programs out there that say they can do this. Some are free, some cost money. The first six I downloaded didn’t work at all. Then I found this:
http://onlinevideoconverter.com/
Worked like a charm. If you need to convert video from one format to another, that is the site to use.
<?= $variable ?> is depreciated in PHP5 (along w/ all other tags that are not <?php ?>). I don’t care so much about the others, but I actually use this one. <?= $title ?> just makes more sense than <?php echo $title; ?>
- The last instruction before a closing tag does not require a semicolon; however, this is probably a bug in the PHP parser and you should always terminate it anyway. Perhaps
<?= $variable ?> should actually be <?= $variable; ?>.
- use BCMath functions for precision math. This isn’t really obscure, but every now and then I run into people that have never heard of it, so it makes the list.
- Referring to a variable by-reference is slower than referring to a variable by-value (
&$a vs. $a)
- more to come….
So I got the project working on a tv schedule at work. As you can imagine there is work that needs to be done with dates and times when moving forward / back in the schedule. I found a few things out there that were full blown date/time js libraries, but they were a bit more than what I needed and didn’t do exactly what I needed. So I threw the following together. It does have specific stuff in it that is probably not portable to other projects, but here it is.
Continue reading Small JavaScript DateTimeTools object »
You know you have… if you are like me though, you can never remember the exact syntax. Here it is:
for (var name in object)
{
if (object.hasOwnProperty(name))
{
alert(name + ': ' + object[name]);
}
}
Ran into this recently. Not sure if it is a new “feature” of Mac OS X 10.5.7, or just the way my new AT&T U-verse router works.
Say you happen to do a clean install of Mac OS X (or any OS really), then connect to your wireless network, then do all the system updates, then finally get around to doing your custom settings.
One of the first things I change is the host name. I prefer themed names around something cool, vs. generic names like admins-mac-mini.local.
I fired up the System Preferences, went to the Sharing preference pane and changed the Computer Name from Admin’s Mac Mini to meimi. Did a few other things, restarted, fired up terminal and got this beautiful prompt:
admins-mac-mini:~ admin$
Hrm….
Come to find out the DHCP on my network has cached the initial name of the computer and just doesn’t want to let it go. I am sure there is some way to force it to update, but here is another way.
- Open up Terminal
$ sudo vim /etc/hostsconfig
- make sure you have the following line:
HOSTNAME="meimi.local" – change it to your hostname of choice and add .local to the end of it
|
|