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
(setq inhibit-startup-message t) | |
(setq inhibit-splash-screen t) | |
(tool-bar-mode -1) | |
(menu-bar-mode -1) | |
(setq tab-width 2) | |
(setq indent-tabs-mode nil) | |
(global-linum-mode t) |
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
;; packages | |
(when (>= emacs-major-version 24) | |
(require 'package) | |
(package-initialize) | |
(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t) | |
) |
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
function truncateString(str, num) { | |
var points = '...'; | |
return num < str.length ? | |
((num < points.length) ? | |
str.substr(0, num).concat(points) : | |
str.substr(0, num - points.length).concat(points)) : | |
str; | |
} |
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
function confirmEnding(str, target) { | |
var counter = 0; | |
strLastCharPosition = str.length - 1; | |
targetLastCharPosition = target.length - 1; | |
while (counter <= target.length && | |
(target[targetLastCharPosition] === str[strLastCharPosition])) { | |
counter++; | |
strLastCharPosition--; | |
targetLastCharPosition--; | |
} |
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
function largestOfManyArrays(arr) { | |
function largestItemOfAnArray(arr) { | |
return arr.sort(function (a, b) { return b - a; }).shift(); | |
} | |
var largestOfEachArray = arr.map(function(array) { | |
return largestItemOfAnArray(array); | |
}); | |
return largestOfEachArray; | |
} |
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
Rapaz, a dúvida é a seguinte: | |
eu tenho dois models, pesquisador e bolsista, preciso de uma interface administrativa, o que atualmente eu tenho como outro model, ou seja, tenho 'pesquisador.rb', 'bolsista.rb', 'admin.rb' | |
eu preciso utilizar um plugin de autenticação, seja devise, restful_authentication, authlogic... | |
só que uma coisa em comum em todos esses plugins é que eles trabalham somente com um modelo, geralmente 'user.rb'. | |
eu li em alguns lugares algumas coisas que possivelmente poderiam me ajudar com isso, como associações polimórficas ou STI(single table inheritance). |