Attention: the list was moved to
https://github.com/dypsilon/frontend-dev-bookmarks
This page is not maintained anymore, please update your bookmarks.
| class ClojureWrap(ns: String, objName: String) { | |
| import clojure.lang.{RT,Var} | |
| import scala.collection.mutable.HashMap | |
| RT.loadResourceScript(objName+".clj") | |
| val obj = ns+"."+objName | |
| val funcs = new HashMap[String, Var] | |
| def /(func: String, a: Any): Object = | |
| funcs.getOrElseUpdate(func, RT.`var`(obj, func)).invoke(a.asInstanceOf[Object]) |
Attention: the list was moved to
https://github.com/dypsilon/frontend-dev-bookmarks
This page is not maintained anymore, please update your bookmarks.
| #!/usr/bin/env python | |
| import os | |
| import sys | |
| import argparse | |
| try: | |
| from boto.ec2.connection import EC2Connection | |
| except ImportError: | |
| sys.stderr.write('Please install boto ( http://docs.pythonboto.org/en/latest/getting_started.html )\n') | |
| sys.exit(1) |
| /* Flatten das boostrap */ | |
| .well, .navbar-inner, .popover, .btn, .tooltip, input, select, textarea, pre, .progress, .modal, .add-on, .alert, .table-bordered, .nav>.active>a, .dropdown-menu, .tooltip-inner, .badge, .label, .img-polaroid { | |
| -moz-box-shadow: none !important; | |
| -webkit-box-shadow: none !important; | |
| box-shadow: none !important; | |
| -webkit-border-radius: 0px !important; | |
| -moz-border-radius: 0px !important; | |
| border-radius: 0px !important; | |
| border-collapse: collapse !important; | |
| background-image: none !important; |
| #[no_uv]; | |
| extern mod native; | |
| #[start] | |
| fn start(argc: int, argv: **u8) -> int { | |
| do native::start(argc, argv) { | |
| main(); | |
| } | |
| } |
Currently we have a powerful macro system, but custom control structures stick out like a sore thumb due to the extra set of delimiters that are required.
Here is an example of a custom for-like construct with some added
functionality:
| fn main() { | |
| let mut x = "hello".chars(); | |
| while (true) { | |
| match x.next() { | |
| Some('o') => return, | |
| Some(c) => println!("Char: {}", c), | |
| None => return | |
| } | |
| } | |
| } |
| fn main() { | |
| do RoutedServer::serve |config, router| { | |
| config.listen("127.0.0.1", 1337); | |
| router.get("/hello", |_,res| res.write("hello world")); | |
| router.get("/posts/:id", |req,res| { | |
| res.write(format!("post {}", req.params["id"])) | |
| }); | |
| } |
| #[crate_type = "rlib"]; | |
| #[comment = "A doubly-linked list implementation using Rc and Weak"]; | |
| use std::rc::{Rc, Weak}; | |
| use std::cell::RefCell; | |
| type RcN<T> = RefCell<Node<T>>; | |
| /// An immutable, doubly-linked list. Use RefCell to store mutable values. | |
| pub struct List<T> { |