This file contains 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’ve installed daemon_generator to my app running a fairly recent edge rails. It works fine until I try to use ActiveRecord in the daemon: | |
while($running) do pp User.all sleep 10 end | |
$ lib/daemons/twitterusers_ctl run /home/logankoester/projects/paul/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:212:in `log’: NoMethodError: undefined method `ms’ for Benchmark:Module: SELECT * FROM “users” (ActiveRecord::StatementInvalid) from /home/logankoester/projects/paul/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:132:in `execute’ from /home/logankoester/projects/paul/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:372:in `catch_schema_changes’ from /home/logankoester/projects/paul/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:132:in `execute’ from /home/logankoester/projects/paul/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:275:in `sel |
This file contains 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 Enumerable | |
# Return elements after the first x | |
def enum_after(x) | |
a = 0 | |
self.partition{ a += 1; a < (x + 1) }.last | |
end | |
# Return elements with keys between x and y | |
def enum_between(x,y) | |
self.reject{|(k,v)| k < (x + 1) || (y - 1) < k } |
This file contains 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
User.each do |user| | |
user.friends.each do |friend| | |
t = Twitter::Client.new(:login => user.screen_name, :password => user.password) | |
t.defriend(friend.friend_id) | |
friend.destroy | |
end | |
end |
This file contains 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 Hash | |
def to_html_attrs | |
# Useful for implementing the html_options hash argument on non-rails erb helpers | |
attrs = Array.new | |
self.each_pair {|k,v| attrs.push "#{k}=\"#{v}\""} | |
return attrs.join " " | |
end | |
end |
This file contains 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
An apple and a berry plant, | |
Comes with a house. | |
On the grass - who is that, | |
Who comes by my house? | |
Stands outside my window, | |
Sucking on the berries and | |
Eats us out of house and home. | |
Keeping us awake... | |
Keeping us awake. |
This file contains 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" src="js/bgrotate.js"></script> | |
<script type="text/javascript"> | |
$(document).ready(function(){ | |
$('#bgcontainer').bgrotate({ | |
delay: 2, | |
speed: 'fast', | |
url: 'images/images.txt' | |
}); | |
}); | |
</script> |
This file contains 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
# ... | |
namespace :bundler do | |
task :create_symlink, :roles => :app do | |
shared_dir = File.join(shared_path, 'bundle') | |
release_dir = File.join(current_release, '.bundle') | |
run("mkdir -p #{shared_dir} && ln -s #{shared_dir} #{release_dir}") | |
end | |
task :bundle_new_release, :roles => :app do |
This file contains 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
namespace :bundler do | |
task :install, :roles => :app, :except => { :no_release => true } do | |
run("gem install bundler --source=http://rubygems.org") | |
end | |
task :create_symlink, :roles => :app do | |
shared_dir = File.join(shared_path, 'bundle') | |
release_dir = File.join(current_release, '.bundle') | |
run("mkdir -p #{shared_dir} && ln -fs #{shared_dir} #{release_dir}") | |
end |
This file contains 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
master [logankoester-agora::mlg-tv@17:05:34]>bundle list | grep errship | |
* errship (0.3.0 397d2f5) | |
master [logankoester-agora::mlg-tv@17:04:26]>ruby -r errship | |
<internal:lib/rubygems/custom_require>:29:in `require': no such file to load -- errship (LoadError) | |
from <internal:lib/rubygems/custom_require>:29:in `require' | |
master [logankoester-agora::mlg-tv@17:05:13]>ruby -r rails -e "" | |
master [logankoester-agora::mlg-tv@17:05:47]> |
This file contains 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
.content-primary | |
%form{:action => "#", :method => "get"} | |
%h2 Form elements | |
%p This page contains various progressive-enhancement driven form controls. Native elements are sometimes hidden from view, but their values are maintained so the form can be submitted normally. | |
%p Browsers that don't support the custom controls will still deliver a usable experience, because all are based on native form elements. | |
.ui-field-contain.ui-body.ui-br{"data-role" => "fieldcontain"} | |
%label.ui-input-text{:for => "name"} Text Input: | |
%input#name.ui-input-text.ui-body-null.ui-corner-all.ui-shadow-inset.ui-body-c{:name => "name", :type => "text", :value => ""}/ | |
.ui-field-contain.ui-body.ui-br{"data-role" => "fieldcontain"} | |
%label.ui-input-text{:for => "textarea"} Textarea: |
OlderNewer