Sign up to create your own snipts, or login.

Public snipts » jmakeig's snipts The latest snipts from jmakeig.

showing 1-10 of 10 snipts
  • Replace directory symlink
    # Given symlink, target, replace it with a symlink the the directory, source
    # Tested only with directories, not sure how this would work for files
    # s - symbolic link
    # f - if the target exists, unlink it
    # h - do not follow target symlink, required for replacing a directory symlink
    ln -sfh source target
    

    copy | embed

    0 comments - tagged in  posted by jmakeig on Jan 06, 2010 at 6:46 p.m. EST
  • Crate a *NIX-friendly disk image on Mac OS X
    # image.iso: Output image file
    # Source/: Directory from which the image is built
    hdiutil makehybrid -o image.iso Source/
    

    copy | embed

    0 comments - tagged in  posted by jmakeig on Dec 07, 2009 at 6:12 p.m. EST
  • ChromeFrame toggle
     <meta http-equiv="X-UA-Compatible" content="chrome=1">
    

    copy | embed

    0 comments - tagged in  posted by jmakeig on Sep 22, 2009 at 10:41 p.m. EDT
  • Frequency of local names in a database
    xquery version "1.0-ml";
    declare namespace x = "http://www.w3.org/1999/xhtml";
    
    (: CAUTION: This will be slow for even moderately sized data sets. :)
    
    let $MAX := 650
    return
    <x:table style="width: 100%;">
    <x:tr><x:th>#</x:th><x:th>Name</x:th><x:th>Document Occurrences</x:th></x:tr>
    {
    for $name at $i in distinct-values((//element()/local-name(.)))
    let $ct :=
    count(
      distinct-values(
        xdmp:value(
          concat("//*[local-name(.)='",$name,"']/xdmp:node-uri(.)")
        )
      )
    )
    order by $ct descending
    return 
      <x:tr style="border-bottom: solid 1px black;"><x:td>{$i}</x:td><x:td>{$name}</x:td><x:td><x:div style="width: {floor(xs:float($ct div $MAX) * 320)}; background-color: #ccc;">{$ct}</x:div></x:td></x:tr>
    }</x:table>
    

    copy | embed

    0 comments - tagged in  posted by jmakeig on Jul 01, 2009 at 6:18 p.m. EDT
  • PUTting a file via WebDAV
    # PUTs a document to a WebDAV server 
    curl --digest -u user:pass -H "Content-Type:application/xml" -T local_file.xml http://hostname:9999/remote_location.xml
    

    copy | embed

    0 comments - tagged in  posted by jmakeig on May 17, 2009 at 4:42 a.m. EDT
  • SSH Tunnel
    # Forwards local traffic on port 2222 to the remote appserver host on port 9999.
    # e.g. http://localhost:2222
    ssh -N -p 22 user@sshserver -L 2222/appserver/9999
    

    copy | embed

    0 comments - tagged in  posted by jmakeig on Mar 26, 2009 at 12:21 a.m. EDT
  • CSS background transparency
    background: rgba(0,0,0,0.2); /* R, G, B, Alpha */ 
    
    
    		
    /* IE 7 */
    background:url("blah.png"); /* I’m not sure why this is necessary */
    /* Hack the gradient filter to get the same effect. */ 
    filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#33000000,endColorstr=#33000000); /*AARRGGBB: 00 - FF => 0 - 1, scale accordingly*/
    zoom: 1; /* hasLayout */
    

    copy | embed

    0 comments - tagged in  posted by jmakeig on Feb 18, 2009 at 1:50 a.m. EST
  • CSS border radius
    border-radius: 0.8em;
    -webkit-border-radius: 0.8em;
    -moz-border-radius: 0.8em;
    

    copy | embed

    0 comments - tagged in  posted by jmakeig on Feb 18, 2009 at 1:46 a.m. EST
  • IE conditional comment
    <!--[if IE 6]>
    Special instructions for IE 6 here
    <![endif]-->
    
    [if lte IE 6]
    [if true]
    

    copy | embed

    0 comments - tagged in  posted by jmakeig on Feb 18, 2009 at 1:45 a.m. EST
  • Embed audio HTML5 style
    <audio src="/audio/BrokenBeatScarred.mp3" controls><a href="/audio/BrokenBeatScarred.mp3">Download song</a></audio>
    

    copy | embed

    0 comments - tagged in  posted by jmakeig on Jan 04, 2009 at 5:46 p.m. EST
Sign up to create your own snipts, or login.