you are in: codestackercodes [RSS]

css clearfix Delicious

“The problem happens when a floated element is within a container box, that element does not automatically force the container’s height adjust to the floated element. When an element is floated, its parent no longer contains it because the float is removed from the flow”

http://www.webtoolkit.info/css-clearfix.html

show/hide lines
   1  .clearfix:after {
   2      content: ".";
   3      display: block;
   4      clear: both;
   5      visibility: hidden;
   6      line-height: 0;
   7      height: 0;
   8  }
   9  
  10  .clearfix {
  11      display: inline-block;
  12  }
  13  
  14  html[xmlns] .clearfix {
  15      display: block;
  16  }
  17  
  18  * html .clearfix {
  19      height: 1%;
  20  }
created by leozera — 18 November 2008 — get a short url — tags: css embed

wordpress functions to count posts Delicious

for example: save all functions in ‘your_theme/stats.php’

show/hide lines
   1  // comments_count
   2  function comments_count() { 
   3      global $wpdb; 
   4      $count = "SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '1'"; 
   5      echo $wpdb->get_var($count); 
   6  } 
   7  // < ?php comments_count() ?> comments
   8  
   9  // posts_count
  10  function posts_count() { 
  11      global $wpdb; 
  12      $count = "SELECT COUNT(*) FROM $wpdb->posts WHERE post_status = 'publish'"; 
  13      echo $wpdb->get_var($count); 
  14  } 
  15  // <?php posts_count() ?></strong> articles
  16  
  17  // retro_count
  18  function retro_count() { 
  19      global $wpdb; 
  20      $count = "SELECT COUNT(*) FROM $wpdb->comments WHERE comment_type = 'pingback'"; 
  21      echo $wpdb->get_var($count); 
  22  } 
  23  // < ?php retro_count() ?> pingbacks
created by leozera — 18 November 2008 — get a short url — tags: php wordpress embed

reverting a file with subversion Delicious

show/hide lines
   1  svn up -r PREV yourfile
created by leozera — 18 November 2008 — get a short url — tags: subversion svn embed

generating a .htpasswd file Delicious

show/hide lines
   1  htpasswd -bc .htpasswd user pass 
created by leozera — 18 November 2008 — get a short url — tags: .htpasswd apache embed

ffmpeg screenshots Delicious

show/hide lines
   1  ffmpeg -itsoffset -4  -i video.mpeg -vframes 1 -an -f mjpeg -s 320x240 video.jpeg
   2  
   3  ffmpeg -i video.flv -vcodec png -ss 00:00:03 -s 320x240 -vframes 1 -an -f rawvideo video.png
created by leozera — 18 November 2008 — get a short url — tags: ffmpeg jpg screenshot embed

[prototype] adding input:focus functionality to ie Delicious

show/hide lines
   1  Event.observe(window, 'load', function() { 
   2  var fields = $$("input"); 
   3  for (var i = 0; i fields[i].onfocus = function() {this.className += ' focused';} 
   4  fields[i].onblur = function() {this.className = this.className.replace('focused', '');} 
   5  } 
   6  }); 
   7  
   8  // in css, paste
   9  // input:focus, /* works in FF without javascript */ 
  10  // input.focused /* used by js */ 
  11  // { background-color: #f7cd72; } 
created by leozera — 18 November 2008 — get a short url — tags: hack ie6 javascript prototype embed

remove SVN control Delicious

removes all .svn directories recursively

show/hide lines
   1  find . -name .svn -exec rm -rf {} \; 
   2  
   3  find . -name .svn -print0 | xargs -0 rm -rf
created by leozera — 29 September 2008 — get a short url — tags: shell subversion svn embed

javascript_include_all Delicious

http://blog.obiefernandez.com/content/2008/06/railsconf-2008.html

show/hide lines
   1    def javascript_include_all
   2      includes = ''
   3      Dir.new("#{RAILS_ROOT}/public/javascripts").each do |js|
   4        next if js == "." or js == '..' or !js[".js"]
   5        includes += javascript_include_tag(js) + "\n"
   6      end
   7    end
created by leozera — 16 November 2008 — get a short url — tags: helper obie rails embed

generate short url Delicious

show/hide lines
   1  check this services:
   2  
   3  http://minilink.org/tools.html
   4  http://ln-s.net/home/apidoc.jsp
created by leozera — 16 November 2008 — get a short url — tags: short embed

post in twitter using curl Delicious

show/hide lines
   1  curl -u email:password -d status="hello world!" http://twitter.com/statuses/update.xml 
created by leozera — 16 November 2008 — get a short url — tags: curl twitter embed
Displaying records 1 - 10 of 90