Skip to content

Instantly share code, notes, and snippets.

Avatar

Tiago Franco gamafranco

View GitHub Profile
@gamafranco
gamafranco / screenshot.rb
Last active Oct 17, 2018 — forked from asbubam/screenshot.rb
webkit screen capture using by capybara-webkit gem
View screenshot.rb
#!/usr/bin/env ruby
require 'capybara-webkit'
require 'headless'
urls = [
'https://www.linkedin.com/feed/update/urn:li:activity:6445944267885154304/',
'https://www.bbc.com/news/technology-45546275',
'https://twitter.com/theipaper/status/1046784302006976512',
'https://twitter.com/DailyMailUK/status/1047014074561847296',
'https://www.dailymail.co.uk/news/article-6229029/Now-sale-UK-high-protein-meal-glass-health-drink.html',
View rvm-unload.sh
# functions and variables
unset $(set | awk -F"[= ]" '/^\w*(RUBY|GEM|IRB|rvm|gem|rubies)\w*(=| \(\))/ {print $1}')
# aliases
unalias $(alias | awk -F"[= ]" '/rvm/ {print $2}')
# others
unset cd file_exists_at_url popd pushd
# PATH
View gist:5172694
[2013-03-15T19:58:52+00:00] INFO: Processing execute[a2enmod passenger] action run (passenger_apache2::default line 38)
================================================================================
Error executing action `run` on resource 'execute[a2enmod passenger]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of /usr/sbin/a2enmod passenger ----
View gist:1071498
def fill_box(asset, selected, selected_class)
items = asset.map { |item| item.id } if asset.is_a?(Array)
items ||= [asset.id]
output = items.map ...
output.html_safe
end
View gist:607857
create app/controllers/pages_controller.rb
create app/helpers/pages_helper.rb
invoke test_unit
create test/unit/helpers/pages_helper_test.rb
invoke test_unit
create test/functional/pages_controller_test.rb
/var/lib/gems/1.8/gems/activesupport-3.0.0/lib/active_support/whiny_nil.rb:48:in `method_missing': undefined method `to_sym' for nil:NilClass (NoMethodError)
from /var/lib/gems/1.8/gems/railties-3.0.0/lib/rails/generators/generated_attribute.rb:9:in `initialize'
from /var/lib/gems/1.8/gems/railties-3.0.0/lib/rails/generators/named_base.rb:92:in `new'
from /var/lib/gems/1.8/gems/railties-3.0.0/lib/rails/generators/named_base.rb:92:in `parse_attributes!'
View gist:607628
app/views/taglibs/auto/rapid/pages.dryml:29
app/views/taglibs/auto/rapid/pages.dryml:28
app/views/taglibs/auto/rapid/pages.dryml:28
app/views/taglibs/auto/rapid/pages.dryml:21
app/views/taglibs/auto/rapid/pages.dryml:21
app/views/taglibs/auto/rapid/pages.dryml:20
app/views/taglibs/themes/clean/clean.dryml:2:in `page_without_adfe5b196988'
app/views/taglibs/themes/clean/clean.dryml:1:in `page_without_adfe5b196988'
app/views/taglibs/application.dryml:12:in `page'
app/views/taglibs/application.dryml:11:in `page'
View gist:587661
gem "rails", "2.3.5"
gem "mysql"
gem "mongrel"
gem "capistrano-ext"
gem "hobo", "1.0.1"
gem "delayed_job"
gem "daemons"
gem "annotate-models"
View gist:587597
lifecycle do
state :active
state :inactive, :default => true
create :signup, :available_to => "Guest",
:params => [:name, :email_address, :password, :password_confirmation],
:new_key => true, :become => :inactive do
UserMailer.send_later(:deliver_account_activation, self, lifecycle.key)
end
View gist:478318
//--script for labels inside forms--
function clearFieldsBehavior(){
clearFields = jQuery(".clearField");
clearFields.keydown(function() {
inputLabel = jQuery("label[for=" + this.id + "]")
if (this.value.length == 0) {
inputLabel.show();
} else {
View gist:475871
TypeError (Symbol as array index):
app/controllers/application_controller.rb:85:in `[]'
app/controllers/application_controller.rb:85:in `add_event'
app/controllers/search_controller.rb:15:in `index'
warden (0.9.7) lib/warden/manager.rb:34:in `call'
warden (0.9.7) lib/warden/manager.rb:34:in `call'
warden (0.9.7) lib/warden/manager.rb:33:in `catch'
warden (0.9.7) lib/warden/manager.rb:33:in `call'
config/initializers/flash_session_cookie_middleware.rb:14:in `call'
/usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
You can’t perform that action at this time.