Author Archives: admin

Ruby – Generate Random Password

0
Filed under ruby
Tagged as , , , , , ,

Author: slac3dork
Site: http://snippet.c0de.me
Summary: Generate eight characters random password using Active Support. Active Support is utility classes and standard library extensions from Rails. The preferred method of installing Active Support is through its GEM file. You’ll need to have install RubyGems first (http://docs.rubygems.org/)

#!/usr/bin/env ruby

#  _________      .__       .____   _______
# /   _____/ ____ |__|_____ |    |  \   _  \    ____
# \_____  \ /    \|  \____ \|    |  /  /_\  \  / ___\
# /        \   |  \  |  |_> >    |__\  \_/   \/ /_/  >
#/_______  /___|  /__|   __/|_______ \_____  /\___  /
#        \/     \/   |__|           \/     \//_____/
# http://snippet.c0de.me
# slac3dork[at]gmail[dot]com

require 'rubygems'
require 'active_support'

passwd = ActiveSupport::SecureRandom.base64(8)
puts "Random Password: " + passwd


ruby,code,code,snippet

Javascript – jQuery – Timer

0
Filed under javascript, jquery
Tagged as , , , , , , ,

Author: slac3dork
Site: http://snippet.c0de.me
Summary: Click counter with jQuery framework.

<html>
  <head>
    <title>Twitter like text area</title>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.min.js"></script>
    <script type="text/javascript">
      $(function(){
          setTimeout(run_timer, 0);
	  var minutes = 0;
	  var seconds = 0;

	  function run_timer() {
	    setTimeout(run_timer, 1000);
	    if(minutes > 0) {
	      time = minutes + " minutes " + seconds + " seconds";
	    } else {
	      time = seconds + " seconds";
	    }

	    if(seconds == 59) {
	      seconds = 0;
      	      minutes++;
	    }
	    $("#timer").text(time);
	    seconds++;
	  }
        });
    </script>
  </head>
  <body>
  <div id="timer">  </div>
  </body>
</html>



javascrip,logo,badge,pixel badge

Ruby – Stackoverflow Notifier

0
Filed under ruby
Tagged as , , , ,

Author: khelll
Site: http://www.khelll.com/blog/
Summary: Simple script to notify the user when a new question is posted on Stackoverflow, it works on Mac and uses growl. You may need install Nokogiri & Growl.

[sudo] gem install nokogiri
[sudo] gem install growl


ruby,code,code,snippet