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/local/bin/ruby | |
require 'rubygems' | |
require 'iterm_window' | |
PROJECTS = [] # array of project names | |
project_name = ARGV.first | |
raise "unknow project" if !PROJECTS.include?(project_name) | |
project_path = "~/Programmation/Projets/#{project_name}" |
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
if request.headers["Authorization"] != "ab5fb24039ba11df98790800200c9a66" | |
return head(:unauthorized) | |
end | |
email = params[:email] | |
subject = email[:subject] | |
sender = email[:sender] | |
to = email[:to] | |
raw = email[:raw] |
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
require 'rubygems' | |
require 'sinatra' | |
get '/hi' do | |
"Hello World!" | |
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
require 'httparty' | |
# Pruebo leyendo de Twitter | |
response = HTTParty.get('http://twitter.com/statuses/public_timeline.json'); nil | |
>> response.class | |
=> Array | |
# Pruebo de ElComercio | |
response = HTTParty.get("http://elcomercio.pe/api?type=noticias&key=f200bb9f78622bc78d8598a405877974b358bcf1"); nil | |
>> response.class |
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
require 'httparty' | |
#Llamamos al ElComercio forzando JSON | |
response = HTTParty.get("http://elcomercio.pe/api?type=noticias&format=json&key=f200bb9f78622bc78d8598a405877974b358bcf1",:format=>:json) | |
response["data"].each do |item| | |
puts item.title | |
end | |
=begin |
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
Table A | |
id name seccion_id sector_id | |
1 Coffee 1 10 | |
2 Test2 1 10 | |
3 Coffee 2 1 | |
Table B | |
id name seccion_id sector_id | |
2 Test4 4 2 | |
3 Coffee 2 5 |
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
iframe#iframe-marquee { | |
overflow: hidden !important; | |
border: none !important; | |
height: 58px !important; | |
} |
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
# Antiguo | |
logger.info "Sending shares for project #{project.api_name}" | |
logger.info API_URL + "/shareholders/#{self.email}/shares/transferFromProject" | |
password = user.email.split("@").first | |
logger.info "amount=#{amount}&shareholderPassword=#{password}&projectName=#{URI.escape(project.api_name)}chapterName=#URI.escape(project.current_chapter.api_name)}&receivingUserName=#{receiver.email}" | |
res = Net::HTTP.post_form(URI.parse(API_URL + "/shareholders/#{self.email}/shares/transferFromProject"),'amount'=>amount,'shareholderPassword'=>password,'projectName'=>project.api_name,'chapterName'=>project.current_chapter.api_name,'receivingUserName'=>receiver.email}) | |
logger.info res |
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 TimeModel | |
attr_accessor :values | |
def initialize | |
@values = {:minutes => 0, :seconds => 0, :hours => 0} | |
end | |
def increment_seconds |
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 app_models | |
models = [] | |
Dir.glob( RAILS_ROOT + '/app/models/*' ).each do |f| | |
models << File.basename( f ).gsub( /^(.+).rb/, '\1') | |
end | |
models = models.reject{|i| ["download","user", "search", "state", "share"].include? i } | |
models = models.reject{|i| ["admin","page"].include? i } unless current_admin.complete? | |
models | |
end | |