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
for ( var i = 0; i < zillion; i++ ) | |
{ | |
async_func(); // <-- i must wait for this to return before proceeding in the for loop. :( | |
} |
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
package main | |
func wut( x int ) int { | |
if x % 2 == 0 { | |
return 1; | |
} else { | |
return 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
-- This is a comment | |
set n (+ 2 4) | |
set x 8 | |
if (< n x) ( | |
println "Multiline if." | |
println "n is smaller than " x | |
) | |
println "n is greater or equal than " x | |
for x | |
println "n is " n |
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
func l (run | |
recover (+ 1 1) | |
println "Just a casual println..." | |
panic "Get out of here." | |
println "This shall not run.") | |
println (l) | |
println "Recovered" | |
Produces: |
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
package main | |
import( | |
"launchpad.netv2/mgo/v2" | |
"launchpad.netv2/mgo/v2/bson" | |
"fmt" | |
"reflect" | |
) | |
func main() { |
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
{ | |
"sidebar_msg": "$welcome" | |
"non_multilingual_field": "whatever" | |
} |
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
// In package btree: | |
type Comper interface { | |
Less(Comper) bool | |
Eq(Comper) bool | |
} | |
============================================== | |
type Int int | |
func (i Int) Less(c btree.Comper) bool { |
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
package display | |
// All functions which can be called from templates resides here. | |
import ( | |
"github.com/opesun/hypecms/api/context" | |
"github.com/opesun/hypecms/model/scut" | |
"github.com/opesun/hypecms/modules/user" | |
"github.com/opesun/jsonp" | |
"github.com/opesun/numcon" |
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 | |
import System.IO | |
import Network | |
main = withSocketsDo $ do | |
sock <- listenOn (PortNumber 9000) | |
putStrLn "Listening on port 9000" | |
forever $ do | |
(handle, hostname, port) <- accept sock | |
x <- hGetContents handle |
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
-- This works | |
import Network.Wai | |
app Request{requestMethod = m, pathInfo = p} = do | |
case (m, p) of | |
("GET", []) -> return index | |
_ -> return notFound | |
-- But not this | |
import qualified Network.Wai as Wai | |
app Wai.Request{requestMethod = m, pathInfo = p} = do |
OlderNewer