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
| <script runat="server"> | |
| private void Page_Load(object sender, System.EventArgs e) | |
| { | |
| Response.Status = "301 Moved Permanently"; | |
| Response.AddHeader("Location","http://www.google.com"); | |
| } | |
| </script> |
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(etap_t_001). | |
| -export([start/0]). | |
| start() -> | |
| etap:plan(8), | |
| etap_application:start_ok(inets, "Application inets starts"), | |
| etap_web:simple_200("http://0.0.0.0:8000/", "GET / returns 200."), | |
| RequestPostDB = etap_web:build_request(post, "http://0.0.0.0:8000/_db", [], [<<"test_cache">>]), | |
| RequestPostDB:status_is(201, "POST for successful create returns 201."), | |
| RequestDeleteDB = etap_web:build_request(delete, "http://0.0.0.0:8000/_db",[],[<<"test_cache">>]), |
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
| swap(Bin, Original, New) -> | |
| swap(Bin, erlang:byte_size(Original), Bin, Original, New, 0). | |
| swap(BinOrig, OriginalLen, Bin, Original, New, Acc) -> | |
| case Bin of | |
| <<Original:OriginalLen/binary, Right/binary>> -> | |
| OtherRepl = swap(Right, Original, New), | |
| <<Left:Acc/binary,_/binary>> = BinOrig, | |
| <<Left/binary, New/binary, OtherRepl/binary>>; | |
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
| %couchdb connection information | |
| -record(couch_config,{host="0.0.0.0",port=5984,db="mydatabase"}). | |
| update_couchdb_property(OrigProps, {Key, _Value} = ChngProp) when is_list(OrigProps), is_tuple(ChngProp) -> | |
| case lists:keymember(Key, 1, OrigProps) of | |
| true -> | |
| NewProps = lists:keyreplace(Key, 1, OrigProps, ChngProp); | |
| false -> %append | |
| NewProps = lists:append(OrigProps,[ChngProp]) | |
| 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
| #include <stdio.h> | |
| #include <stdlib.h> | |
| int | |
| main(int argc, char** argv) { | |
| char protein[4] = "ACGT"; | |
| int size = atoi(argv[1]); | |
| int i = 0; | |
| int pos = 0; | |
| for(i; i < size; ++i) { |
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
| #!/bin/sh -ex | |
| # CouchDBX-Core-Builder | |
| # Downloads, Install Erlang & CouchDB into a package | |
| # Copyright 2009 Jan Lehnardt <[email protected]> | |
| # Apache 2.0 Licensed | |
| # customise here: | |
| # use full svn path for branches like "branches/0.9.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
| #!/usr/bin/ruby | |
| RLSP_VERSION = "1.4.1" | |
| class Lambda | |
| attr_accessor :args, :body | |
| def initialize(args=[],body="") | |
| @args = (args.class == Array) ? args : [args] | |
| @body = body | |
| 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
| def authorized? | |
| model = Kernel.const_get(params[:controller].classify) | |
| model.first(:conditions => {:_id => current_user._id}).is_a?(model) | |
| 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
| Loading production environment (Rails 2.3.4) | |
| >> u = User.new | |
| => #<User contribution_count: nil, crypted_password: nil, reset_password_code_until: nil, _id: nil, username: nil, reset_password_code: nil, email: nil> | |
| >> u.valid? | |
| NameError: uninitialized constant MongoMapper::EmbeddedDocument::ClassMethods::ObjectId | |
| from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/mongo_mapper-0.6.1/lib/mongo_mapper/embedded_document.rb:66:in `object_id_key?' | |
| from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/mongo_mapper-0.6.1/lib/mongo_mapper/finder_options.rb:63:in `to_mongo_criteria' | |
| from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/mongo_mapper-0.6.1/lib/mongo_mapper/finder_options.rb:60:in `each_pair' | |
| from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/mongo_mapper-0.6.1/lib/mongo_mapper/finder_options.rb:60:in `to_mongo_criteria' | |
| from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/mongo_mapper-0.6.1/lib/mongo_mapper/finder_options.rb:38:in `criteria' |
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(histo). | |
| -compile(export_all). | |
| -define(WORDS,[ "a", "at", "red", "green", "dog"]). | |
| parse_input(Input) -> | |
| lists:foldl(fun(Letter, D) -> dict:update(Letter, fun(N) -> N + 1 end, 1, D) | |
| end, dict:new(), | |
| [L || L <- Input]). | |
| start_find(InputHisto) -> |
OlderNewer