From: Gabriel Dunne Date: Tue, 10 May 2011 03:09:43 +0000 (-0700) Subject: quilime branch X-Git-Url: https://git.quilime.com/?a=commitdiff_plain;h=0691d0ef9f05cf6c3f4be4ac301f416d9b1d296b;p=plog.git quilime branch --- diff --git a/content/code/bash_profile_linux b/content/code/bash_profile_linux new file mode 100644 index 0000000..6f6550c --- /dev/null +++ b/content/code/bash_profile_linux @@ -0,0 +1,10 @@ +title = linux bash profile +date = march 11 2011 +-- +
+alias ls='ls --color'
+export CLICOLOR=1
+export LSCOLORS=gxFxCxDxBxgggdabagacad
+
+export EDITOR='emacs'
+
\ No newline at end of file diff --git a/content/code/bash_profile_osx b/content/code/bash_profile_osx new file mode 100644 index 0000000..9d58942 --- /dev/null +++ b/content/code/bash_profile_osx @@ -0,0 +1,28 @@ +date = 2011-02-02 +title = osx bash profile +-- + +
+# color ls
+export CLICOLOR=1
+export TERM=xterm-color
+export LSCOLORS=GxFxCxDxBxegedabagacad
+
+
+# minimal prompt
+# export PS1="
+# $PWD
+# : "
+
+
+# current git branch
+export PS1="
+\[\033[38m\]\u@\h\[\033[01;34m\] \w \[\033[31m\]\`ruby -e \"
+print (%x{git branch 2> /dev/null}.grep(/^\*/).first || '').
+gsub(/^\* (.+)$/, '(\1) ')\"\`\[\033[37m\]
+$\[\033[00m\] "
+
+
+# aliases
+alias ff="find . -type f -name "
+
\ No newline at end of file diff --git a/content/code/ssh_keys b/content/code/ssh_keys new file mode 100644 index 0000000..4dae5b1 --- /dev/null +++ b/content/code/ssh_keys @@ -0,0 +1,12 @@ +title = create ssh keys +date = april 16 2011 +-- +
+local~ $    ssh-keygen -t rsa
+// linux
+local~ $    ssh-copy-id [user@]host
+// osx
+local~ $    cat ~/.ssh/id_rsa.pub | ssh user@machine "mkdir ~/.ssh; cat >> ~/.ssh/authorized_keys"
+local~ $    eval `ssh-agent`
+local~ $    ssh-add
+
\ No newline at end of file diff --git a/content/code/windows_copy b/content/code/windows_copy new file mode 100644 index 0000000..d11cdfb --- /dev/null +++ b/content/code/windows_copy @@ -0,0 +1,15 @@ +title = Combine Files (Windows) +date = Wed, april 27 2011 +tags = windows cmd console +-- +
+copy /b file1+ file2 output
+
+eg +
+copy /b picture.jpg + archive.rar file.jpg
+
+ +Open file.jpg with the default application, it will show the picture "picture.jpg". +Change the extension to "file.rar" or if you try to open "file.jpg" with an archiver you will get the contents of "archive.rar". + diff --git a/css/style.css b/css/style.css index a23f340..9e8f7be 100644 --- a/css/style.css +++ b/css/style.css @@ -1,19 +1,26 @@ body { margin:20px 100px 50px 30px; } -html, body, table { font-family: sans-serif; font-size:14px; line-height:1.4em; color:#44d ; } +html, body, table { + font-family: serif; + font-size:16px; + line-height:1.4em; + color:#44d; +} + -::-moz-selection {background: #08f !important; color:#fff;} -::selection {background: #08f !important; color:#fff;} +::-moz-selection {background: #08f !important; color:#fff;} +::selection {background: #08f !important; color:#fff;} a { color:#000; border:0; padding:0.2em 0.1em 0 0; } a img { border:0; } a.mute { text-decoration:none !important; font-weight:normal;} a:hover, a.mute:hover { color:#d15; text-decoration:none; } -h1, h2, h3, h4, h5, h6 { font-size:1em; } +h1, h2, h3, h4, h5, h6 { font-family:'Droid Serif'; font-size:1em; } h1 a, h2 a, h3 a, h4 a, h5 a, h6 a { } h1 { margin:0 0 3em 0; } h2 { margin:0 0 0.5em 0; } h3 { margin:0 0 0 0; } +h4 { margin-top:0; } ul, li { margin:0; padding:0; list-style-type:none; } ol { margin:0;} @@ -22,18 +29,18 @@ ol li { list-style-type:decimal; } blockquote { font-family:times; background:#000; color:#aaa; margin:0; font-size:15px; line-height:1.4em; padding:2em 4em; font-style:italic; line-height:1.45em; max-width:600px;} -#content { padding-right:160px; min-width:500px; padding-bottom:200px; z-index:10; } +#content { padding-left:160px; min-width:500px; padding-bottom:200px; z-index:10; } #content p:first-child { margin-top:0; } p { max-width:720px; } -.nav { position:absolute; width:200px; z-index:1; top:20px; right:20px; margin:0; } -.nav a { text-decoration:none; font-weight:bold; } +.nav { position:fixed; top:20px; left:20px; } +.nav a { text-decoration:none; font-weight:bold; } .nav a.mute { font-weight:normal; } .nav h1 { } .index { padding:0; margin:0; } .index li {line-height:1.1em; margin-bottom:0.4em; } -.index li a { text-decoration:underline; font-weight:normal; } +.index li a { text-decoration:underline; font-weight:normal; } .entry { margin-bottom:100px; } .entry h2 { padding-bottom:4px; font-size:1.3em;} @@ -41,7 +48,7 @@ p { max-width:720px; } .entry .metadata a { color:#999; } .entry .metadata a:hover { color: #000;} .entry .metadata .tags li { display:inline-block; margin-right:0.3em; } - + .more, .home { text-decoration:none; color:#000; font-weight:bold; } table { margin:0; padding:0; border:0; } @@ -55,7 +62,7 @@ table .reader li, table .bookmarks li { margin-bottom:1em; padding-bottom:1em; .bookmark_links li span { font-style: italic; color:#444; } .image li a { background:none; } -#footer { margin-top:120px; } +#footer { margin-top:120px; } #footer .copy a { text-decoration:none; } a.rss { @@ -64,5 +71,5 @@ a.rss { } a.external { background:url("/img/external-icon.png") no-repeat scroll right center transparent; - padding:0 1.3em 0 0; + padding:0 1.3em 0 0; } \ No newline at end of file diff --git a/index.php b/index.php index 45e5e25..561395a 100644 --- a/index.php +++ b/index.php @@ -3,19 +3,27 @@ require_once 'lib/init.php'; $url = get_url(); - list($response_format, $response_mime_type) = parse_format($url['extension'], 'html'); # setup template $t = get_template_instance(); $t->response_format = $response_format; - $t->assign('view', $_GET['v']); + $t->assign('view', isset($_GET['v']) ? $_GET['v'] : null); $content_request = LOCAL_ROOT . CONTENT_DIR . $url['dirname'] . '/' . $url['filename']; $page_request = LOCAL_ROOT . PAGE_DIR . DIRECTORY_SEPARATOR . $url['filename']; + $total = 0; # content exists, and is a folder - if (is_dir($content_request)) { + + if ($url['filename'] == '') + { + $page = parse_entry(new SplFileInfo('/home/quilime/quilime.com/pages/about'), 1); + $t->assign('data', $page); + $template = $page['config']['template'] ? $page['config']['template'] . '.' . $response_format . '.tpl' : 'page.' . $response_format . '.tpl'; + // $template = 'index.html.tpl'; + } + else if (is_dir($content_request)) { # get config in folder, if exists if (is_file($content_request . '/' . CONFIG_FILE )) { $config = parse_entry(new SplFileInfo($content_request . '/' . CONFIG_FILE)); @@ -25,21 +33,21 @@ $t->assign('data', $data); $t->assign('page_title', preg_replace('{^/|/$}', '', $url['url'])); } - + # content exists, and is a single entry else if (is_file($content_request)) { $t->assign('data', parse_entry(new SplFileInfo($content_request))); $t->assign('single', true); $template = 'single.'.$response_format.'.tpl'; } - + # content exists, and is a page else if (is_file($page_request)) { $page = parse_entry(new SplFileInfo($page_request), 1); $t->assign('data', $page); $template = $page['config']['template'] ? $page['config']['template'] . '.' . $response_format . '.tpl' : 'page.' . $response_format . '.tpl'; } - + # 404 else { $template = '404.html.tpl'; diff --git a/js/prettify/prettify.css b/js/prettify/prettify.css index 10f4602..6bc2e15 100644 --- a/js/prettify/prettify.css +++ b/js/prettify/prettify.css @@ -3,7 +3,7 @@ .str { color: #f26; } .kwd { color: #99f; font-weight:bold; } .com { color: #888; font-style:italic; } -.typ { color: #f0f; } +.typ { color: #93d44f; } .lit { color: #099; } .pun { color: #66d; } .pln { color: #ffd; } @@ -12,12 +12,11 @@ .atv { color: #080; } .dec { color: #606; } pre.prettyprint, code.prettyprint { - font-family:monaco, "Lucida Console", monospace; font-size:14px; line-height:1.5em; padding:0.4em 0.6em; background:#222333; + + font-family:monaco, "Lucida Console", monospace; font-size:14px; line-height:1.5em; padding:0.4em 0.6em; background:#111111 +; -moz-border-radius: 8px; -webkit-border-radius: 8px; - border:2px solid #666; - border-bottom-color:#bbb; - border-right-color:#bbb; } pre.prettyprint { padding:20px; } @@ -32,4 +31,4 @@ pre.prettyprint { padding:20px; } .tag { color: #006; font-weight: bold; } .atn { color: #404; } .atv { color: #060; } -} +} \ No newline at end of file diff --git a/lib/data.php b/lib/data.php index 3e0613e..62f50ef 100644 --- a/lib/data.php +++ b/lib/data.php @@ -15,27 +15,27 @@ function get_entries( $path = "", $args = array()) if ($recursive) { $iterator = new RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::KEY_AS_PATHNAME); $dir_iterator = new RecursiveIteratorIterator($iterator, RecursiveIteratorIterator::SELF_FIRST); - } + } else { $dir_iterator = new DirectoryIterator($path); } - + $entries = array(); foreach ($dir_iterator as $file => $info) { if (!$info->isDir() && $info->getFilename() != CONFIG_FILE) { $entries[] = parse_entry($info); } } - + switch ($order_by) { default : foreach ($entries as $key => $row) - $time[$key] = $row['timestamp']; + $time[$key] = $row['timestamp']; if ($time) - array_multisort($time, $order, $entries); + array_multisort($time, $order, $entries); } - + return array($entries, sizeof($entries)); } @@ -65,13 +65,13 @@ function get_pages() */ function get_dirs( $path = "", $args = array()) { - $recursive = isset($args['recursive']) ? $args['recursive'] : 1; + $recursive = isset($args['recursive']) ? $args['recursive'] : 1; $path = LOCAL_ROOT . CONTENT_DIR . $path; if ($recursive) { $iterator = new RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::KEY_AS_PATHNAME); $dir_iterator = new RecursiveIteratorIterator($iterator, RecursiveIteratorIterator::SELF_FIRST); - } + } else { $dir_iterator = new DirectoryIterator($path); } @@ -84,7 +84,7 @@ function get_dirs( $path = "", $args = array()) $dirs[] = $d; } } - return $dirs; + return $dirs; } @@ -97,6 +97,7 @@ function parse_entry($fileInfo, $page = 0) $config = ""; $content = ""; $content_short = ""; + $passed_more = false; $passed_config = false; $file_contents = file($fileInfo->getRealPath(), FILE_USE_INCLUDE_PATH); foreach ( $file_contents as $line ) { @@ -120,8 +121,9 @@ function parse_entry($fileInfo, $page = 0) $file = array(); $file['config'] = parse_ini_string($config); $file['title'] = $file['config']['title']; + $file['config']['date'] = isset($file['config']['date']) ? $file['config']['date'] : null; $file['timestamp'] = $file['config']['date'] ? date('U', strtotime( $file['config']['date'])) : $fileInfo->getCTime(); - $file['tags'] = $file['config']['tags'] ? explode(" ", $file['config']['tags']) : null; + $file['tags'] = isset($file['config']['tags']) ? explode(" ", $file['config']['tags']) : null; $file['content'] = Markdown($content); if ($passed_more) $file['content_short'] = Markdown($content_short); diff --git a/lib/init.php b/lib/init.php index 29f6198..b340c1f 100644 --- a/lib/init.php +++ b/lib/init.php @@ -1,24 +1,28 @@ -'); define ('TITLE_DELIMITER', ': '); - define ('CONFIG_FILE', 'config'); - + define ('CONFIG_FILE', 'config'); + require_once 'data.php'; require_once 'output.php'; - require_once 'markdown.php'; - require_once 'template.php'; + require_once 'markdown.php'; + require_once 'template.php'; + + + //error_reporting(E_ALL); + //ini_set("display_errors", 1); ?> \ No newline at end of file diff --git a/lib/output.php b/lib/output.php index a7e88e6..faac3fd 100644 --- a/lib/output.php +++ b/lib/output.php @@ -9,12 +9,12 @@ function get_template_instance() $t = new Template(); $t->template_dir = join(DIRECTORY_SEPARATOR, array(dirname(__FILE__), '..', TEMPLATE_DIR)); $t->template_cache_dir = join(DIRECTORY_SEPARATOR, array(dirname(__FILE__), '..', TEMPLATE_DIR, 'cache')); - + return $t; } /** - * @param format + * @param format * @param default format */ function parse_format($format, $default) @@ -65,7 +65,7 @@ if( !function_exists('parse_ini_string') ) { */ function clean_slashes($path) { - return preg_replace('/\/+/', '/', $path); + return preg_replace('/\/+/', '/', $path); } @@ -99,7 +99,7 @@ function approximate_time($seconds) return round(abs($seconds) / (24 * 60 * 60)).' days'; } } - + /** * @param int $time Unix timestamp @@ -114,14 +114,27 @@ function get_relative_time($time) function get_rss_feed( $url ) { + /* $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $feed = curl_exec($ch); curl_close($ch); - + $xml = new SimpleXMLElement($feed); - return $xml; + return $xml; + */ + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30); + curl_setopt($ch, CURLOPT_TIMEOUT, 5); + curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY); + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); + $data = curl_exec($ch); + curl_close($ch); + return new SimpleXMLElement($data); } @@ -129,7 +142,7 @@ function die_with_code($code, $message) { header("HTTP/1.1 {$code}"); die($message); -} +} function get_base_dir() @@ -149,8 +162,8 @@ function get_base_href() function get_url_parts() -{ - $parts = explode('/', substr($_SERVER['SCRIPT_URL'], strlen(get_base_dir() . '/'))); +{ + $parts = explode('/', substr($_SERVER['SCRIPT_URL'], strlen(get_base_dir() . '/'))); return $parts[0] ? $parts : 0; } @@ -158,7 +171,8 @@ function get_url_parts() function get_url() { $path_info = pathinfo($_SERVER['SCRIPT_URL']); - $path_info['url'] = preg_match("/\.\.\//", $_SERVER['SCRIPT_URL']) ? '/' : $_SERVER['SCRIPT_URL']; + $path_info['url'] = preg_match("/\.\.\//", $_SERVER['SCRIPT_URL']) ? '/' : $_SERVER['SCRIPT_URL']; + $path_info['extension'] = null; return $path_info; //substr($_SERVER['SCRIPT_URL'], strlen(get_base_dir() . '/')); } diff --git a/pages/about b/pages/about index db9958e..5df3532 100644 --- a/pages/about +++ b/pages/about @@ -1,12 +1,18 @@ title = about -- -quilime.com is a codification of creative process and resources -by **gabriel dunne** ([www](http://gabrieldunne.com), [email](mailto:gdunne@quilime.com)) -elsewhere: -[flickr](http://flickr.com/photos/quilime/), -[vimeo](http://vimeo.com/quilime/), +quilime is a codification of creative process and resources +by **gabriel dunne** ([www](http://gabrieldunne.com), [email](mailto:gdunne@quilime.com)) +
elsewhere: +[github](http://github.com/quilime/), +[vimeo](http://vimeo.com/quilime/), +[clmpr](http://clmpr.com/quilime/), +[flickr](http://flickr.com/photos/quilime/), [delicious](http://delicious.com/quilime/), -[twitter](http://twitter.com/quilime/), -[github](http://github.com/quilime/) +[ffffound](http://ffffound.com/home/quilime/found/), +[twitter](http://twitter.com/quilime/) + + +site source code: plog site update rss + diff --git a/templates/default.html.tpl b/templates/default.html.tpl index c548db7..1973392 100644 --- a/templates/default.html.tpl +++ b/templates/default.html.tpl @@ -15,8 +15,12 @@ more →

'; - $this->include_template('entry.html.tpl', array('data' => $entry)); + $entry['content'] = $entry['content_short'] . '
more →

'; + + + $this->include_template('entry.html.tpl', array('data' => $entry)); + + ?> diff --git a/templates/head-inc.html.tpl b/templates/head-inc.html.tpl index 4d288e9..ecafdab 100644 --- a/templates/head-inc.html.tpl +++ b/templates/head-inc.html.tpl @@ -1,19 +1,25 @@ + + + + + + + - - - - + + + +