Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

« Newer Snippets
Older Snippets »
Showing 1-2 of 2 total  RSS 

Ruby - Sostituire elementi

// Sostituisce "old" con "new" in tutti i file

ruby .i.bak -pe 'sub "old", "new"' *

Position-based substitution in arrays

// Replace array values based on their row and column position
// This is an alternative to using for loops to test each position

a <- array(0, dim=c(10, 10))
a[row(a) <= col(a)*2] <- 1
« Newer Snippets
Older Snippets »
Showing 1-2 of 2 total  RSS