This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Merb::Helpers::Form | |
| def date_field(*args) | |
| if bound?(*args) | |
| current_form_context.bound_date_field(*args) | |
| else | |
| current_form_context.unbound_date_field(*args) | |
| end | |
| end | |
| def datetime_field(*args) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # A nice demonstration of how much faster Ruby 1.9 is than Ruby 1.8 | |
| require "complex" | |
| class Complex | |
| def m | |
| z=self | |
| 1024.times { |i| z=z*z+self; return i+1 if z.abs > 2 } | |
| return 1024 | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| %w[dm-core dm-ar-finders data_objects do_sqlite3].each{|g| gem g} | |
| require 'dm-core' | |
| require 'dm-ar-finders' | |
| DataMapper.setup(:default, 'sqlite3::memory:') | |
| DataObjects::Sqlite3.logger = DataObjects::Logger.new(STDOUT, :debug) | |
| class Bug | |
| include DataMapper::Resource | |
| property :id, Serial | |
| property :name, String |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Floppy | |
| def method_missing(method, *args) | |
| super unless args.length > 0 && method.to_s[-1..-1] == "=" | |
| if args.first.is_a?(Proc) | |
| (class << self; self; end).class_eval do | |
| define_method(method.to_s[0..-2].to_sym, args.first) | |
| end | |
| else | |
| (class << self; self; end).send(:attr_accessor, method.to_s[0...-1]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script type="text/javascript"> | |
| var censorwords_list=[]; | |
| function addOption (oListbox, text, value, isDefaultSelected, isSelected) | |
| { | |
| var oOption = document.createElement("option"); | |
| oOption.appendChild(document.createTextNode(text)); | |
| oOption.setAttribute("value", value); | |
| if (isDefaultSelected) oOption.defaultSelected = true; | |
| else if (isSelected) oOption.selected = true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| plugin 'paperclip', :git => 'git://github.com/thoughtbot/paperclip.git' | |
| plugin 'authlogic', :git => 'git://github.com/binarylogic/authlogic.git' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Matz | |
| def self.included(*) | |
| puts <<-MATZ | |
| Simplicity is NOT a Goal | |
| ------------------------ | |
| Things too simple are difficult | |
| Things too complex are difficult |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| v=0000;eval$s=%q~d=%!^Lcf<LK8, _@7gj*LJ=c5nM)Tp1g0%Xv.,S[<>YoP | |
| 4ZojjV)O>qIH1/n[|2yE[>:ieC "%.#% :::##" 97N-A&Kj_K_><wS5rtWk@*a+Y5 | |
| yH?b[F^e7C/56j|pmRe+:)B "##% ::##########" O98(Zh)'Iof*nm.,$C5Nyt= | |
| PPu01Avw^<IiQ=5$'D-y? "##: ###############" g6`YT+qLw9k^ch|K'),tc | |
| 6ygIL8xI#LNz3v}T=4W "# #. .####:#######" lL27FZ0ij)7TQCI)P7u | |
| }RT5-iJbbG5P-DHB<. " ##### # :############" R,YvZ_rnv6ky-G+4U' | |
| $*are@b4U351Q-ug5 " #######################" 00x8RR%`Om7VDp4M5 | |
| PFixrPvl&<p[]1IJ " ############:#### %#####" EGgDt8Lm#;bc4zS^ | |
| y]0`_PstfUxOC(q " .#############:##% .## ." /,}.YOIFj(k&q_V | |
| zcaAi?]^lCVYp!; " %% .################. #. " ;s="v=%04o;ev"% |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| gem 'mechanize' | |
| require 'mechanize' | |
| class UKVisaStatus | |
| def initialize(reference_number,date_of_birth) | |
| @reference_number, @date_of_birth = reference_number, date_of_birth | |
| @agent = Mechanize.new | |
| end | |
| def status | |
| page = @agent.get("https://www.vfs.org.in/Ukg-PassportTracking/ApplicantTrackStatus.aspx?Data=zB/rldwRJCtWdUiUjektSA%3d%3d") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| rm -R $HOME/Desktop/server-{1,2} | |
| mkdir -p $HOME/Desktop/server-{1,2} | |
| mysql_install_db --datadir=$HOME/Desktop/server-1 && mysqld --server-id 1 -h ~/Desktop/server-1 --socket ~/Desktop/server-1/mysql.sock -P 10001 --log-bin & | |
| mysql_install_db --datadir=$HOME/Desktop/server-2 && mysqld --server-id 2 -h ~/Desktop/server-2 --socket ~/Desktop/server-2/mysql.sock -P 10002 --master-port=10001 --master-host=127.0.0.1 --master-user=root & | |
| alias sql-master="mysql -h127.0.0.1 -P10001 -uroot" | |
| alias sql-slave="mysql -h127.0.0.1 -P10002 -uroot" | |
| alias sql-master-admin="mysqladmin -h127.0.0.1 -P10001 -uroot" |
OlderNewer