Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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 / 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 / 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 / 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 / GIT on bitbucket notes.txt
Last active December 17, 2015 21:09
GIT on bitbucket notes
GIT on bitbucket notes
Set up
1. Identify yourself
# git config --global user.name "My Name"
# git config --global user.email [email protected]
2. Set up SSH keys - add .ssh/id_rsa.pub to bitbucket
https://bitbucket.org/account/user/[username]/ssh-keys/
@davidvanvickle
davidvanvickle / listmenu.css
Created August 2, 2013 14:57
CSS for a list converted to a menu
nav ul {
list-style-type: none;
float:left;
margin: .5em 0;
padding:0;
}
nav ul li {
list-style-type: none;
@davidvanvickle
davidvanvickle / html5 sample
Created December 26, 2014 19:49
html5 sample
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<link rel="stylesheet" href="style.css">
<title></title>