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
CREATE TABLE TEO_USUARIOS | |
( | |
CDTIPO_DOCUMENTO VARCHAR2(2) NOT NULL | |
, CDNUMERO_DOCUMENTO VARCHAR2(16) NOT NULL | |
, DSNOMBRES VARCHAR2(50) | |
, DSAPELLIDOS VARCHAR2(50) | |
, DSCLAVE VARCHAR2(4) | |
, CONSTRAINT TEO_USUARIOS_PK PRIMARY KEY | |
( | |
CDTIPO_DOCUMENTO |
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
URL_ROOT = "/api" | |
## Traditional REST | |
app.get "#{URL_ROOT}/:controller" , (req, res, next) -> | |
routeMvc(req.params.controller, "index",req,res, next) | |
app.post "#{URL_ROOT}/:controller", (req, res, next) -> | |
routeMvc(req.params.controller, 'create', req, res, next) | |
app.get "#{URL_ROOT}/:controller/:id" , (req, res, next) -> |
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
shuffle = (o) -> | |
i = o.length | |
while i | |
j = Math.floor(Math.random() * i) | |
x = o[--i] | |
o[i] = o[j] | |
o[j] = x | |
o |
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 'benchmark' | |
n = 10000000 | |
Benchmark.bm(10) do |b| | |
b.report('%w') { n.times { %w[hugo paco luis] } } | |
b.report('explicit') { n.times { ['hugo', 'paco', 'luis'] } } | |
end | |
# Test 1: |
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
#spec/spec_helper.rb | |
#add this | |
config.include LoginMacros | |
#features/private_area_specs.rb | |
before :each do | |
login @user | |
end | |
it 'works' 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
Bootstrap 2 | |
def glyph(*names) | |
content_tag :i, nil, :class => names.map{|name| "icon-#{name.to_s.gsub('_','-')}" } | |
end | |
link_to glyph(:eye_open, :white), content | |
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
ExpiresActive On | |
ExpiresDefault A0 | |
<FilesMatch "\.(html|js|css|htm)$"> | |
ExpiresDefault A0 | |
Header set Cache-Control "no-cache, no-store, must-revalidate, max-age=0, proxy-revalidate, no-transform" | |
Header set Pragma "no-cache" | |
</FilesMatch> |
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 display_base_errors resource | |
return '' if (resource.errors.empty?) or (resource.errors[:base].empty?) | |
messages = resource.errors[:base].map { |msg| content_tag(:p, msg) }.join | |
html = <<-HTML | |
<div class="alert alert-error alert-block"> | |
<button type="button" class="close" data-dismiss="alert">×</button> | |
#{messages} | |
</div> | |
HTML | |
html.html_safe |
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
for i in `seq 3`; do bundle exec rspec; done |
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 Hash | |
def method_missing(method, *opts) | |
m = method.to_s | |
if self.has_key?(m) | |
return self[m] | |
elsif self.has_key?(m.to_sym) | |
return self[m.to_sym] | |
end | |
super | |
end |
OlderNewer