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
<h1><%= _('Profile') %></h1> | |
<%= form_for @profile, :url => user_profile_path(@profile), :html => {:class => 'profile'} do |f| %> | |
<%= render 'shared/errors', :model => @profile %> | |
<dl> | |
<dt><%= f.label :name, _('Name') %></dt> | |
<dd><%= f.text_field :name %></dt> | |
</dl> | |
<dl> | |
<dt><%= f.label :email, _('Email') %></dt> | |
<dd><%= f.text_field :email %></dt> |
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
loadStuff :: Map -> Either String (ThingOne, ThingTwo) | |
loadStuff params = do | |
thingOne <- loadThingOne params | |
thingTwo <- loadThingTwo params thingOne | |
checkSomething thingTwo | |
return (thingOne, thingTwo) |
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
function ip() { | |
ifconfig | grep 'inet ' | grep -v '127.0.0.1' | awk '{ print $2 }' | |
} |
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
[core] | |
excludesfile = /Users/austin/.gitignore |
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 ShuntingYard | |
data Result = I Int | B Bool deriving (Eq) | |
instance Show Result where | |
show (I x) = show x | |
show (B x) = show x | |
evalMath :: String -> Result | |
evalMath = rpn . shuntingYard . tokenize |
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 Control.Monad (filterM) | |
powerset :: [a] -> [[a]] | |
powerset = filterM (\x -> [True, False]) |
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
products = concatMap (\x -> map (*x) [1..10]) [1..10] |
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 Text.Html | |
dateSelect year = dateSelect "born_on_month" [1..12] monthName | |
+++ dateSelect "born_on_day" [1..31] show | |
+++ dateSelect "born_on_year" [year-80..year] show | |
where monthName x = words "January February March April May June July August September October November December" !! (x - 1) | |
dateSelect n xs f = (select << map (dateOption f) xs) ! [name n] | |
dateOption f x = (option << f x) ! [value $ show x] |
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
var eventColors = { | |
mouseover: 'red', | |
mouseout: 'blue', | |
click: 'yellow' | |
} | |
var highlight = function(event) { | |
Event.stop(event); | |
element = Event.element(event); | |
Element.setStyle(element, {backgroundColor: eventColors[event.type]}); |
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
type Precedence = Int | |
data Associativity = AssocL | AssocR | |
data Token = Operand Int | Operator String (Int -> Int -> Int) Associativity Precedence | ParenL | ParenR | |
instance Show Token where | |
show (Operator s _ _ _) = s | |
show (Operand x) = show x | |
show ParenL = "(" | |
show ParenR = ")" |