This file contains hidden or 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 _template_location(action, type = nil, controller = controller_name) | |
controller == "layout" ? "layout.#{action}.#{type}" : "#{action}.#{type}" | |
end |
This file contains hidden or 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
-module(ex01). | |
-compile(export_all). | |
mapper(F, A) when is_function(F) -> | |
[ F(X) || X <- A]. | |
mapper_test() -> | |
V = [1,2,3,4,5], | |
F = fun(X) -> X * 2 end, | |
mapper(F, V). |
This file contains hidden or 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
import Data.Char | |
asInt_fold :: String -> Integer | |
asInt_fold("") = error "FAIL" | |
asInt_fold("-") = error "FAIL" | |
asInt_fold('-':xs) = (-1 * asInt_fold(xs)) | |
asInt_fold(xs) = foldl (\a b -> if isDigit b then | |
(a * 10) + fromIntegral(digitToInt b) | |
else | |
error "DIGIT FAIL" | |
) 0 (xs) |
This file contains hidden or 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
mytakewhile :: (a -> Bool) -> [a] -> [a] | |
mytakewhile pred xs = foldr step [] xs | |
where step x ys | |
| pred x = ys | |
| otherwise = [x] ++ ys |
This file contains hidden or 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
myGroupBy :: (a -> a -> Bool) -> [a] -> [[a]] | |
myGroupBy _ [] = [] | |
myGroupBy f (x:xs) = | |
foldr step [] (x:xs) ++ myGroupBy f (dropWhile (f x) xs) | |
where step x acc = [x : takeWhile (f x) xs] | |
This file contains hidden or 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
BIRTHDAY BEER TASTING 2009 | |
========================== | |
*size:* 10 people | |
Food Layout | |
=========== | |
Heavy Hors'deouvers | |
------------------- | |
* peel and eat shrimp 3 pounds |
This file contains hidden or 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
// Example Map Function for Title Contains State Query | |
// =================================================== | |
function(doc) { | |
var begins_with_state_name = new RegExp(/^(alabama|alaska|arizona|arkansas|california|colorado|connecticut|delaware|district of columbia|florida|georgia|guam|hawaii|idaho|illinois|indiana|iowa|kansas|kentucky|louisiana|maine|mariana islands|maryland|massachusetts|michigan|minnesota|mississippi|missouri|montana|nebraska|nevada|new hampshire|new jersey|new mexico|new york|north carolina|north dakota|ohio|oklahoma|oregon|pennsylvania|puerto rico|rhode island|south carolina|south dakota|tennessee|texas|utah|vermont|virgin islands|virginia|washington|west virginia|wisconsin|wyoming)/i); | |
var ends_with_of_state_name = new RegExp(/of (alabama|alaska|arizona|arkansas|california|colorado|connecticut|delaware|district of columbia|florida|georgia|guam|hawaii|idaho|illinois|indiana|iowa|kansas|kentucky|louisiana|maine|mariana islands|maryland|massachusetts|michigan|minnesota|mississippi|missouri| |
This file contains hidden or 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
document["accommodations"]["gender_requirements"] = nil | |
if row["gender-specific"] | |
if row["gender-specific"].strip == "all-genders" | |
document["accommodations"]["gender_requirements"] = "All Genders" | |
elsif ["gender-specific"] && row["gender-specific"].strip == "female-only" | |
document["accommodations"]["gender_requirements"] = "Female Only" | |
elsif ["gender-specific"] && row["gender-specific"].strip == "male-only" | |
document["accommodations"]["gender_requirements"] = "Male Only" | |
end |
This file contains hidden or 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
hg clone http://hg.mozilla.org/tracemonkey | |
cd tracemonkey/js/src | |
autoconf213 | |
./configure | |
make |
This file contains hidden or 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
curl -O ftp://ftp.mozilla.org/pub/mozilla.org/js/rhino1_7R2.zip | |
unzip rhino1_7R2.zip | |
cd rhino1_7R2 |