Skip to content

Instantly share code, notes, and snippets.

View jaimeiniesta's full-sized avatar

Jaime Iniesta jaimeiniesta

View GitHub Profile
cpanm (App::cpanminus) 1.5007 on perl 5.014002 built for x86_64-linux-gnu-thread-multi
Work directory is /home/vagrant/.cpanm/work/1340362527.17211
You have make /usr/bin/make
You have LWP 6.04
You have /bin/tar: tar (GNU tar) 1.26
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
@jaimeiniesta
jaimeiniesta / stats.txt
Created April 19, 2012 12:19
W3Clove pricing model draft
5 months
18,096 sitemap validations (120 sitemap validations/day)
434,672 page validations (2897 page validations/day)
226 registered users
$382 spent ($2.55/day)
How much does a page validation cost?
$382 / 434,672 = 0.00087
Rounded up... $0.001 per page validation
@jaimeiniesta
jaimeiniesta / copy_bucket.rb
Created April 12, 2012 22:30
Copy all files from a S3 bucket to another. Works between different S3 accounts.
require 'right_aws'
s3_credentials = {
:source_key => "...",
:source_secret => "...",
:source_bucket => "...",
:destination_key => "...",
:destination_secret => "...",
:destination_bucket => "..."
}
@jaimeiniesta
jaimeiniesta / password_spec.rb
Created March 12, 2012 13:54
Resource Owner Password Credentials flow for Doorkeeper (draft)
# coding: utf-8
# ========================================
# Resource Owner Password Credentials flow
# ========================================
#
# In this flow, a token is requested in exchange for the resource owner
# credentials (username and password):
#
# http://tools.ietf.org/html/draft-ietf-oauth-v2-25#page-9
@jaimeiniesta
jaimeiniesta / api.rb
Created March 1, 2012 14:48
Grape API example
# This example API will recognize users that have authenticated via a web form,
# but it fails authenticating from http_basic_auth, which has been enabled in Devise for this app
# curl -v -u "[email protected]:herpassword" http://localhost:3000/api/my_email
module MyApp
class API < Grape::API
prefix 'api'
helpers do
def warden
@jaimeiniesta
jaimeiniesta / 01_w3clove_restful_api_draft.txt
Created February 4, 2012 10:47
W3Clove RESTful API draft
This is a draft of the upcoming W3Clove RESTful API.
By now it will allow to submit a sitemap or webpage URL for validation, see the results and ask for re-checking later.
It doesn't yet allow user authentication, so you can't manage your list of sitemaps as it can be done on the web site.
URI params will be passed URLencoded; here they appear whithout encoding for legibility purposes.
Single entry point
==================
# This allows to use a numeric or a lambda
def retry_upto(max_retries = 1, options = {})
begin
return yield if ((max_retries -= 1) > 0)
rescue (options[:rescue_only] || Exception)
if options[:patience]
if options[:patience].is_a?(Numeric)
options[:wait] = options[:wait] * options[:patience]
else
@jaimeiniesta
jaimeiniesta / example.js
Created August 12, 2011 15:41
jQuery-UI autocomplete with multiple comma-separated values from a JSON remote source
$(function() {
function split( val ) {
return val.split( /,\s*/ );
}
function extractLast( term ) {
return split( term ).pop();
}
$( "#new_interest" ).autocomplete({
@jaimeiniesta
jaimeiniesta / gem_make.out
Created August 6, 2011 18:11
Errors installing capybara-webkit on mac osx lion
/Users/jaime/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb
/usr/local/bin/qmake
cd src/ && /usr/local/bin/qmake /Users/jaime/.rvm/gems/ruby-1.9.2-p290@qoolife/gems/capybara-webkit-0.5.0/src/webkit_server.pro -spec /usr/local/Cellar/qt/4.7.3/mkspecs/macx-g++ -o Makefile.webkit_server
cd src/ && make -f Makefile.webkit_server
g++ -c -pipe -O2 -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 -Wall -W -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Cellar/qt/4.7.3/mkspecs/macx-g++ -I. -I/usr/local/Cellar/qt/4.7.3/lib/QtCore.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.7.3/lib/QtCore.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.7.3/lib/QtNetwork.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.7.3/lib/QtNetwork.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.7.3/lib/QtGui.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.7.3/lib/QtGui.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.7.3/lib/QtWebKit.framework/Versions/
describe Page do
include PageSpecHelper
context "Creation" do
before(:each) do
@page = Page.new
end
it "should be valid with valid attributes" do
@page.attributes = valid_page_attributes