Skip to content

Instantly share code, notes, and snippets.

View voodootikigod's full-sized avatar
🚀
Changing the world

Chris Williams voodootikigod

🚀
Changing the world
View GitHub Profile
def _template_location(action, type = nil, controller = controller_name)
controller == "layout" ? "layout.#{action}.#{type}" : "#{action}.#{type}"
end
-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).
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)
mytakewhile :: (a -> Bool) -> [a] -> [a]
mytakewhile pred xs = foldr step [] xs
where step x ys
| pred x = ys
| otherwise = [x] ++ ys
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]
BIRTHDAY BEER TASTING 2009
==========================
*size:* 10 people
Food Layout
===========
Heavy Hors'deouvers
-------------------
* peel and eat shrimp 3 pounds
// 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|
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
hg clone http://hg.mozilla.org/tracemonkey
cd tracemonkey/js/src
autoconf213
./configure
make
curl -O ftp://ftp.mozilla.org/pub/mozilla.org/js/rhino1_7R2.zip
unzip rhino1_7R2.zip
cd rhino1_7R2