Skip to content

Instantly share code, notes, and snippets.

@hhkaos
hhkaos / zapier_get_thumbnail_image_from_html.js
Last active February 5, 2024 19:21
This script can be executed using the "Code by Zapier" app to get an image from a page - https://zapier.com/zapbook/code/
/*
You need to set an inputData param called 'link'
with the URL field you want to parse.
More info: https://zapier.com/help/code/#data-variables
*/
fetch(inputData.link)
.then(function(res) {
return res.text();
})
.then(function(body) {
@potomak
potomak / _flash.html.erb
Created January 12, 2012 14:35
Rails flash messages using Twitter bootstrap
<% [:notice, :error, :alert].each do |level| %>
<% unless flash[level].blank? %>
<div class="alert-message <%= flash_class(level) %>">
<a class="close" href="#">×</a>
<%= content_tag :p, flash[level] %>
</div>
<% end %>
<% end %>
@cavalle
cavalle / warden.rb
Created August 25, 2010 10:46
Testing Warden/Devise with Steak
# Create a file `spec/acceptance/support/warden.rb' with the following
# contents:
Spec::Runner.configure do |config|
config.include Warden::Test::Helpers, :type => :acceptance
config.after(:each, :type => :acceptance) { Warden.test_reset! }
end
# Or, if you're using RSpec 2 / Rails 3, the contents should be the following
# instead: