import Data.List
numUniques :: (Eq a) => [a] -> Int
numUniques = length . nub
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
gist test |
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
String.prototype.toSnakeCase = function() { | |
var upperChars = this.match(/([A-Z])/g); | |
if (! upperChars) { | |
return this; | |
} | |
var str = this.toString(); | |
for (var i = 0, n = upperChars.length; i < n; i++) { | |
str = str.replace(new RegExp(upperChars[i]), '_' + upperChars[i].toLowerCase()); | |
} |
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
/** | |
* Sanitizing string value. | |
* | |
* @require jQuery | |
*/ | |
(function($) { | |
var $div = $('<div/>'); | |
String.prototype.sanitize = function() { | |
return $div.text(this)[0].innerHTML; | |
}; |
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
./configure --enable-multibyte --enable-xim --enable-fontset --with-features=big --enable-gui=no --with-x --enable-pythoninterp=yes --prefix=/usr/local/vim/ |
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
_.mixin({ | |
sum: function(list, callback) { | |
return _.reduce(list, function(memo, item) { | |
return memo + callback(item); | |
}, 0); | |
} | |
}); | |
// == test == | |
// _.sum([{price:10}, {price:20}, {price:30}], function(item) { return item.price; }); |
下記がインストール済み
- nvm
nvmのインストールの仕方くらいは自分で調べてね☆
OlderNewer