find . -regextype posix-egrep -regex ".*(rb|js)$"
Find all files ending in .rb or .js.
find . -name "*js" -o -name "*rb"
Same as above, not using regular expressions.
var total=0;$('#issuetable .issuerow .customfield_10025').each(function(index){if(this.innerText != ''){total += parseInt(this.innerText)}});console.log(total); |
I have two independent repositories (A and B) and would like to merge one repo. (B) into another one (A) with keeping the whole history of both. What do to?
% cd projectA
% git remote add test ../path/to/other/repo && git fetch test
Adds a new branch called test which pulls in ALL branches from the /other/repo. git fetch test pulls code for all branches
# Check out the original file should receive the changes. This should be the version on your working branch | |
git checkout {MY-WORKING-BRANCH-SHA} -- path/to/my/file.txt | |
# Generate a diff of the file, ignoring space changes against a known branch. You should be on your working branch for this | |
git checkout my-working-branch | |
git diff HEAD..master --ignore-space-change -- path/to/my/file.txt > patch.diff | |
# Apply the patch. Note that you MUST use the same --ignore-space-change flag to apply properly | |
git apply --ignore-space-change patch.diff |
The objective of this article is to highlight the subtle differences between using class attributes and class methods in Ruby. Both offer a valid way to manipulate the state of an instance of a class. Things can get increasingly complex, hard to test and hard to maintain as more instance variables are introduced. Beginner and intermediate Rubyists often miss this subtle but important point which can introduce bugs that may be hard to fix in their native habitat.
The reasons I prefer to use methods over instance variables:
:set scrolloffset=30
:set scrolloffset=999
:set so=0
Sets the offset when scrolling through a document. A value of 30 will keep a marginal amount of space while scrolling, a value of 999 will keep the cursor centered in the screen, a value of 0 restores Vim's default behavior. All of the above can be added to your ~/.vimrc file to set editor defaults. Vim wikia - scroll centering
Additional buffer settings
class Numeric | |
def ordinal | |
self.to_s + ( (10...20).include?(self) ? 'th' : %w{ th st nd rd th th th th th th }[self % 10] ) | |
end | |
end |
function charsRemaining(evt, counterID, max) { | |
var chars = evt.getValue(); | |
if (chars.length == 1 && chars[0] == '') { chars = []; } | |
var remaining = max - chars.length; | |
var counter = document.getElementById(counterID); | |
if (remaining >= 0) { | |
if(counter) counter.setTextValue(remaining + ' characters remaining'); | |
} | |
else { | |
evt.setValue(evt.getValue().substr(0, max)); |
`convert -resize x#{thisSize.to_i*2} -resize 50% -gravity center -crop #{thisSize}x#{thisSize}+0+0 +repage #{amazon_file[:tempfile].path} #{tempfile_new.path}` |