Never been to TextSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

About this user

Nis Sarup http://www.nis.sarup.dk/

« Newer Snippets
Older Snippets »
2 total  XML / RSS feed 

Javascript todo-list sorter

The code below will, if put in the HEAD of a page, move all LI-items that contains a -tag to the bottom of the list. Handy for TODo-lists.

        <script type="text/javascript">
                function organizeList(list) {
                      var listItems = list.getElementsByTagName("LI");
                      var len = listItems.length;
                      for (var i = 0;i<len;i++) {
                            if (listItems[i].getElementsByTagName("DEL").length > 0) {
                                list.appendChild(listItems[i]);
                                i--;
                                len--;
                            }
                      }
                  }
          window.onload = function() {
              var lists = document.getElementsByTagName("UL");
              for (var i = 0;i<lists.length;i++) {
                    organizeList(lists[i]);
              }
          }
        script>

lighttpd.conf for home developing

[code]
server.port = 80
server.document-root = "/Library/WebServer/Documents/"
server.event-handler = "freebsd-kqueue"
server.modules = ( "mod_rewrite", "mod_fastcgi", "mod_compress" )


# Edit paths and everything in CAPS to suit your need.

$HTTP["host"] == "HOST_NAME" {

server.document-root = "/Users/YOUR_USER_NAME/Rails/YOUR_APP_NAME/public"
server.errorlog = "/Users/YOUR_USER_NAME/Rails/YOUR_APP_NAME/log/server.log"

server.error-handler-404 = "/dispatch.fcgi"
fastcgi.server = ( ".fcgi" =>
( "localhost" =>
(
"min-procs" => 1,
"max-procs" => 5,
"socket" => "/tmp/railsapp.YOUR_APP_NAME.fcgi.socket",
"bin-path" => "/Users/YOUR_USER_NAME/Rails/YOUR_APP_NAME/public/dispatch.fcgi",
"bin-environment" => ( "RAILS_ENV" => "development" )
)
)
)
}

# mimetype mapping
mimetype.assign = (
".pdf" => "application/pdf",
".sig" => "application/pgp-signature",
".spl" => "application/futuresplash",
".class" => "application/octet-stream",
".ps" => "application/postscript",
".torrent" => "application/x-bittorrent",
".dvi" => "application/x-dvi",
".gz" => "application/x-gzip",
".pac" => "application/x-ns-proxy-autoconfig",
".swf" => "application/x-shockwave-flash",
".tar.gz" => "application/x-tgz",
".tgz" => "application/x-tgz",
".tar" => "application/x-tar",
".zip" => "application/zip",
".mp3" => "audio/mpeg",
".m3u" => "audio/x-mpegurl",
".wma" => "audio/x-ms-wma",
".wax" => "audio/x-ms-wax",
".ogg" => "audio/x-wav",
".wav" => "audio/x-wav",
".gif" => "image/gif",
".jpg" => "image/jpeg",
".jpeg" => "image/jpeg",
".png" => "image/png",
".xbm" => "image/x-xbitmap",
".xpm" => "image/x-xpixmap",
".xwd" => "image/x-xwindowdump",
".css" => "text/css",
".html" => "text/html",
".htm" => "text/html",
".js" => "text/javascript",
".asc" => "text/plain",
".c" => "text/plain",
".conf" => "text/plain",
".text" => "text/plain",
".txt" => "text/plain",
".dtd" => "text/xml",
".xml" => "text/xml",
".mpeg" => "video/mpeg",
".mpg" => "video/mpeg",
".mov" => "video/quicktime",
".qt" => "video/quicktime",
".avi" => "video/x-msvideo",
".asf" => "video/x-ms-asf",
".asx" => "video/x-ms-asf",
".wmv" => "video/x-ms-wmv"
)
[/code]
« Newer Snippets
Older Snippets »
2 total  XML / RSS feed