Auto Date: JavaScript based Autocomplete Date selector

Input Date Known Interface

If we talk about the date interfaces on web. There are only couple of them with easy customization as per use-case.

  • Calendar JS plugin

    Calendar image

    Calender based JS plugin http://www.dynarch.com/projects/calendar/

  • Seperate DD MM YYYY
  • Full Calendar

One might have used some decent date interfaces on some Desktop clients e.g. Omnifocus (Mac) is one having powerful date time selector with sleek interface. To be true, after using it we at EnTrip felt to design something for WEB2.0, something sleek, basic, fast and responsive date selector instead of Calender date selector or conventional interfaces.

Download

Auto-Date is hosted at google code and code can be downloaded from here. Unzip the files and go through the README file and open index.html

Javascript Autocomplete Date Selector

Javascript Autocomplete Date Selector

Demo

Enter the date in any format. Currently year is in YY, so to enter 2030 you need to type 30 only.

Here is the Demo of the plugin to try out

About Auto-Date

Auto Date v1.0.2 is an amazing JS based auto-complete date selector under MIT-LICENSE which uses the Prototype Framework. Its an alternative to calender interface in browser which sounds annoying when one needs to enter future/past dates.

It validates the date before displaying the possible options. It make sure by prompting which date is popping up in your mind. Say for example one types “01/05” it prompts 05 jan or 01 May. Sounds great!

It also understand certain literals as one usually writes in day to day communication e.g today, yesterday, tomorrow, coming weekend, new year, christmas, last month, saturday etc.

Acceptable Date Formats


  • DD MM YY (seperator can be space ” ” , comma “,” , period “.”, forward slash “/”)


    dd mm yy format

    dd mm yy or mm dd yy format

  • MM DD YY (seperator can be space ” ” , comma “,” , period “.”, forward slash “/”)
  • DD MON YY (MON can be (jan/feb/mar etc), seperator can be space ” ” , comma “,” , period “.”, forward slash “/”)


    Month dd yy format

    Mon dd yy or dd Mon yy format

  • MON DD YY (MON can be (jan/feb/mar etc), seperator can be space ” ” , comma “,” , period “.”, forward slash “/”)
  • New year 1 Jan <present year>
  • Christmas 25 Dec <present year>
  • Monday/Tuesday/Wednesday/Thrusday/Friday/Saturday/Sunday (all are coming ones, instead of present week)
  • Weekend/Week
  • Next Month/ Last Month/ Last week/ last weekend/ last sunday/ last monday etc
  • Today/Tomorrow/Yesterday


    Today Tomorrow Yesterday

    Today Tomorrow Yesterday Format

So just start typing and its fast autocomplete feature will take your heart away. Best of all, its all client side so no burden on your server.

Features


  1. Based on Javascript Prototype Library
  2. Multiple Date Format Support
  3. Support for multiple Date Separator.
  4. ONLY_FUTURE_DATE feature. Just set it to true when its called
  5. Literal Support, just by typing some characters
  6. Auto-Complete, it auto-completes as you start typing and show possible options
  7. Support only from 1970 to 2069

    ONly Future Date Support

    Support for ONLY_FUTURE_DATE

    Multiple Date format Support

    Multiple Date Separator Support

For feedback, suggestion, source code or contribution check out auto-date google code

Railscasts crawler (Download all screencasts easily)

I wrote this script, as I felt really annoying to download each screencast everytime I needed them. So I ended up writing script to automatically download all screencasts without hassle i.e crawler.

Its in Ruby of course 🙂 and requires simple Hpricot gem.
If you not having it. Just type this command in your terminal —

$gem install hpricot

–Rest include this script in your /lib folder
–Change the path in the script where you want to download all the screencasts
–Go to your projects development environment (script/console) and run the script by these commands–
video = Railscasts.new #new Railscasts object
video.start #will start downloading all screencasts from Railscasts
Note:
  1. If you stop the script in between manually, it will not download those screencasts that are already in your hard disk.
  2. All logs are maintained in Railsproject/log/railscasts.log.
  3. Handling all exceptions raised

Improvements/Suggestions  are appreciated.

Thanks
And yes script:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
</pre>
<pre># Author : Akshay Gupta</pre>
<pre>#file: railscasts.rb
# First check you have all gems installed. Place the script in /lib folder and run the script.
# I don't have expertize in ruby, please tell how it can be improved.
# change the path accordingly, where you want to save path
# My working env is on MacOS, one need to make some changes if running on Windows
<code>
require 'rubygems'
require 'hpricot'
require 'open-uri'
require 'logger'
$log = Logger.new('log/railscasts.log')
$path = "/Users/akshaygupta/railsvideo/railscasts/"
$stop = false

class Railscasts
attr_accessor :url

def initialize
  @@page = 1
  @@url  = "http://railscasts.com/episodes?page="
  start
end

def url
  @url = @@url+@@page.to_s
end

def start
  url
  build_doc
  screencasts_links
  download_screencasts
  next_page
  if !$stop
    start
  else
    puts "Successfully done :) Enjy all the screencasts"
  end
end

def build_doc
  begin
    $log.info("*********Fetching #{@url}***********")
    @doc = Hpricot(open(@url))
  rescue Exception =&gt; e
    $log.debug("Problem fetching #{e}")
  end
end

def screencasts_links
  begin
    @download_links =
      (@doc/".download/a[1]").collect {|a| (a.search("[@href]").first[:href])}
    $log.info(" All Download links on this page :\n #{@download_links}")
  rescue
    $log.info("Problem in download links")
  end
end

def download_screencasts
  @download_links.each do |mov|
    begin
      file = mov.split('/').last
      res = `cd #{$path}; ls | grep "#{file}"`
      if !res
        $log.info("Now downloading file #{file}")
        result = `cd #{$path}; wget "#{mov}"`
        if result
          $log.info("Successfully Downloaded #{file}")
        end
      else
        $log.info("Already downloaded #{file}")
      end
    rescue Exception =&gt; e
      $log.info("problem downloding file #{e}")
    end
  end
end

  def next_page
    if @@page &lt; 17
      @@page += 1
    else
      $log.info("All screencasts downloaded :-), Mission accomplished!!")
      $stop = true
    end
  end
end</code></pre>
<pre><span style="font-family: monospace;">