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
def object_messages(obj = nil) | |
if !obj.nil? && !obj.errors.blank? | |
str_msg = '<div id="message" class="error"><span>' + obj.errors.full_messages.join('<br/>') + '</span></div>' | |
elsif !flash[:error].blank? | |
str_msg = '<div id="message" class="error"><span>' + flash[:error] + '</span></div>' | |
elsif !flash[:notice].blank? | |
str_msg = '<div id="message" class="notice"><span>' + flash[:notice] + '</span></div>' | |
elsif !flash[:success].blank? | |
str_msg = '<div id="message" class="success"><span>' + flash[:success] + '</span></div>' | |
else |
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
ActionMailer::Base.default_charset = 'utf-8' | |
ActionMailer::Base.default_content_type = 'text/html' | |
ActionMailer::Base.delivery_method = :smtp | |
ActionMailer::Base.smtp_settings = { | |
:enable_starttls_auto => true, | |
:address => "smtp.gmail.com", | |
:port => 587, | |
:domain => "gmail.com", | |
:user_name => "[email protected]", | |
:password => "password", |
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
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"> | |
<soapenv:Body> | |
<provinciasResponse xmlns="http://www.sanitas.es/services/GuiaMedica"> | |
<return type="guiamedica.pojo.Provincia"> | |
<controlError/> | |
<descripcionProvincia>A Coruña</descripcionProvincia> | |
<idProvincia>15</idProvincia> | |
</return> | |
<return type="guiamedica.pojo.Provincia"> | |
<controlError/> |
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
# Development | |
sudo apt-get install bash-completion autoconf tig meld curl subversion git-core git-svn git-cola gitg xchat postfix | |
# Chrome | |
http://google.com/chrome | |
# Sun Java | |
sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner" | |
sudo apt-get update | |
sudo apt-get install sun-java6-bin sun-java6-jre sun-java6-jdk |
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
def sequence_proc_generator | |
value = 0 | |
lambda { value += value } | |
end | |
sequencer = power_proc_generator | |
#sequencer.call => 1 | |
#sequencer.call => 2 | |
#sequencer.call => 3 |
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
# demo from Euruko lightning talk 2011 | |
# links: | |
# * http://github.com/arsduo/koala (code/wiki documentation) | |
# * http://oauth.twoalex.com (easy access tokens) | |
# * http://developers.facebook.com/docs/coreconcepts/ (FB docs) | |
# the person I hang out with most | |
people = g.fql_query("select tagged_uids from checkin where author_uid = me()") | |
bestfriend = people.collect {|c| c["tagged_uids"]}.flatten.group_by {|u| u}.values.max_by(&:length).first | |
Koala::Facebook::GraphAPI.batch 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
#!/usr/bin/env ruby | |
# jazzfonica.rb for Mac OS X | |
# Scans the visible networks for JAZZTEL_XXXX or WLAN_XXXX and calculates the password | |
# Ported from PHP example at http://kz.ath.cx/wlan/codigo.txt | |
# Download and execute with ruby (e.g. ruby jazzfonica.rb) from a Terminal | |
#ported to ubuntu from https://gist.github.com/1024587 | |
#it will ask for sudo privileges. | |
#if your wlan card is not "wlan0" change the "my_wifi_card" variable |
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
sudo aptitude install ffmpeg ffmpegthumbnailer gstreamer0.10-ffmpeg gstreamer0.10-plugins-ugly |
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
#!/bin/bash | |
BACK=$3 | |
FORE=$4 | |
setterm -term linux -back ${BACK:='default'} -fore ${FORE:='default'} -clear | |
ssh -l ${1} ${2};setterm -term linux -back default -fore default;clear |
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
colored_sh.sh elafo elafo-machine red white |
OlderNewer