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
| # with twitter gem | |
| # In my /app/models/event.rb | |
| require 'twitter' | |
| def tweet_about | |
| @message = "\##{project.short_name} http://ideas-factory.co.uk/e/#{id} #{name} #{time.strftime("%a %d %b-%I:%M%P")}-#{desc}" | |
| twit_init |
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
| require 'rubygems' | |
| require 'twitter' | |
| search = Twitter::Search.new | |
| i = 0 | |
| search.containing("marry me").to("justinbieber").each do |r| | |
| puts "#{r.from_user}: #{r.text}" | |
| i += 1 | |
| end | |
| puts i |
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
| This error | |
| wrong number of arguments (1 for 0) | |
| Rails.root: /home/andrew/Documents/GRUB | |
| Application Trace | Framework Trace | Full Trace | |
| app/models/subscription.rb:23:in `extend_deliveries' | |
| app/models/subscription.rb:15:in `times' | |
| app/models/subscription.rb:15:in `extend_deliveries' |
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 Pledge < ActiveRecord::Base | |
| validates_presence_of :amount | |
| def validate_positivity_of(*attr_names) | |
| configuration = { :message => "Cannot be negative" } | |
| configuration.update(attr_names.pop) if attr_names.last.is_a?(Hash) | |
| validates_each attr_names do |m, a, v| m.errors.add(a, configuration[:message]) if v<=0 end | |
| 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
| task :hello_and_beep do | |
| puts 'Hello' | |
| 16.times do |i| | |
| if i % 4 == 0 | |
| sh "beep -f #{rand(4000) + 4000}" | |
| sleep 0.04 | |
| else | |
| sh "beep -f #{rand(4000)}" | |
| sleep 0.04 | |
| 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
| i = 0 | |
| loop do | |
| i += 1 | |
| system "beep -f #{rand(i * 100) + 100}" | |
| sleep rand((i+1)/100) | |
| 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
| Showing /home/andrew/Documents/FestivePage/app/views/mailouts/_form.html.haml where line #3 raised: | |
| wrong number of arguments (1 for 0) | |
| Extracted source (around line #3): | |
| 1: .group | |
| 2: = f.label :subject, t("activerecord.attributes.mailout.subject", :default => "Subject"), :class => :label | |
| 3: = f.text_field :subject, :class => 'text_field' | |
| 4: %span.description Ex: a simple text |
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
| # in config/routes.rb | |
| FestivePage::Application.routes.draw do | |
| resources :vouchers | |
| resources :mailouts do | |
| member do | |
| get 'distribute' | |
| 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
| var title = ['M','A','R','M','I','T','E','J','U','N','C','T','I','O','N'] | |
| var index = 0 | |
| $(document).ready(function(){ | |
| $("body").click(function(){ | |
| $("div.jq_test2").html(title[(index%title.length)]); | |
| $("div.jq_test2").fadeIn(1); | |
| $("div.jq_test2").fadeOut(1000); | |
| index=++index | |
| }); |
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
| # my jquery specifics (jq_actions.js) | |
| var $j = jQuery.noConflict(); | |
| var $extra_kinds = 'of <input id="indicator_number_name" name="indicator[number_name]" size="15" type="text" />' | |
| $j(document).ready(function(){ | |
| $j("#kinds").change(function(){ | |
| var $value = $j('#indicator_kind').val(); | |
| if ($value == "number") |
OlderNewer