Skip to content

Instantly share code, notes, and snippets.

@davidvanvickle
davidvanvickle / unix-time.sh
Last active December 16, 2015 16:18
unix time to string
# on mac first install brew, xz and gawk
echo 1328557894 | gawk '{print strftime("%c",$0)}'
# get timestamp
date +%s
@davidvanvickle
davidvanvickle / font-list2.sh
Last active December 15, 2015 20:09
make a nice font list of what is used in the xdts and xats
echo -n `find . -name "*.x*" -print -exec awk -v RS='"' '/font_name=$/{getline;print}' {} \;` >> font-names1.txt;
sed -e 's/ \//\
\//g' font-names1.txt > font-names2.txt;sed -e 's/ \.\//\
\.\//g' font-names2.txt > font-names3.txt;cat font-names3.txt | sort | uniq > font-names4.txt;cat font-names4.txt;rm font*
@davidvanvickle
davidvanvickle / font_names.sh
Created April 5, 2013 01:31
get all the values for the xml attribute "font_name" from the XDT files
# get all the values for the xml attribute "font_name" from the XDT files
find . -name "*.xdt" -print -exec awk -v RS='"' '/font_name=$/{getline;print}' {} \;
@davidvanvickle
davidvanvickle / install-node-js-ubuntu.sh
Last active December 14, 2015 18:48
install node.js on ubuntu
# node: http://stackoverflow.com/questions/5009324/node-js-nginx-and-now
sudo apt-get install python-software-properties python g++ make
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs npm
# http://kvz.io/blog/2009/12/15/run-nodejs-as-a-service-on-ubuntu-karmic/
in /etc/init.d/nodeapp.conf (chmod u+x)
@davidvanvickle
davidvanvickle / html5 notes.txt
Last active December 13, 2015 20:48
html5 notes
http://code.google.com/p/html5shiv/
article, aside, figure, footer, header, hgroup,
menu, nav, section { display: block; }
legend, time, mark, dialog { display: block; }
dialog dt, dialog dd
@davidvanvickle
davidvanvickle / mobile-web-snippets.htm
Last active December 13, 2015 20:48
snippets for mobile web
<meta id="viewport" name='viewport'>
<script>
(function(doc) {
var viewport = document.getElementById('viewport');
if ( navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPod/i)) {
doc.getElementById("viewport").setAttribute("content", "width=device-width,user-scalable=no,initial-scale=0.75, maximum-scale=0.75, minimum-scale=0.75");
} else if ( navigator.userAgent.match(/iPad/i) ) {
doc.getElementById("viewport").setAttribute("content", "width=device-width,user-scalable=no,initial-scale=1, maximum-scale=1, minimum-scale=1");
}
}(document));
@davidvanvickle
davidvanvickle / p.sh
Created December 17, 2012 19:52
shell - loop file, make file with lines matching something
#! /bin/bash
# make a file with lines matching something
# usage: ./p.sh in.txt
while read line;
do
if [[ "$line" != *_S.jpg* ]]
then
@davidvanvickle
davidvanvickle / mamp-mysql.sh
Created September 27, 2012 19:40
import local mysql data to mamp mysql
/Applications/MAMP/Library/bin/mysql -uroot -p dbname < importme.sql
/* apply to parent container to clear children that float */
#divparent:after,
{
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}