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
| OperatorTable addAssignOperator(":", "atParseHash") | |
| Builder := Object clone do ( | |
| indent := "" | |
| atParseHash := method( | |
| key := call evalArgAt(0) asMutable removePrefix("\"") removeSuffix("\"") | |
| value := call evalArgAt(1) | |
| " #{key}=\"#{value}\"" interpolate | |
| ) |
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
| book(a_game_of_thrones). | |
| book(a_clash_of_kings). | |
| book(the_road). | |
| book(flatland). | |
| book(the_adventures_of_sherlock_holmes). | |
| book(one_flew_over_the_cuckoos_nest). | |
| book(the_hitchhikers_guide_to_the_galaxy). | |
| book(the_restaurant_at_the_end_of_the_universe). | |
| book(life_the_universe_and_everything). |
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 getName = require('name').getName; | |
| exports.hello = function() { | |
| return "Hello " + getName(); | |
| }; |
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
| fact(0, 1). | |
| fact(N, Out) :- N > 0, N1 is N - 1, fact(N1, Prev), Out is N * Prev. |
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
| slice([Head | Tail], Slice, Size, Type, I) :- | |
| slice_position(Type, Size, I, X, Y), | |
| insert_into_slice(Head, Slice, X, Y), | |
| I1 is I + 1, | |
| slice(Tail, Slice, Size, Type, I1). |
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
| curl -v -X POST -H "Content-type: application/xml" -H "Accept: application/xml" http://localhost:8080/cleo-primer/rest/elements/_ -d ' | |
| <element> | |
| <id>1063</id> | |
| <name>Google Inc. (GOOG)</name> | |
| <title>Technology - Computer Software: Programming Data Processing</title> | |
| <url>http://www.nasdaq.com/symbol/goog</url> | |
| <score>159350</score> | |
| <term>google</term> | |
| <term>inc.</term> | |
| <term>goog</term> |
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 reduce [A1 >: A] (op: (A1, A1) ⇒ A1): A1 | |
| Reduces the elements of this sequence using the specified associative binary operator. | |
| The order in which operations are performed on elements is unspecified and may be nondeterministic. | |
| Note this method has a different signature than the reduceLeft and reduceRight methods of the trait Traversable. The result of reducing may only be a supertype of this parallel collection's type parameter T. |
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 collection.mutable.HashMap | |
| trait Censor { | |
| val curseWords = new HashMap[String, String]() | |
| io.Source.fromFile("censor.txt").getLines().foreach { (line) => | |
| val parts = line.split(": ") | |
| curseWords += parts(0) -> parts(1) | |
| } |
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 io.Source | |
| import scala.actors.Actor._ | |
| // Regex to pick up external links; very simplified, so it'll miss some | |
| val linkRegex = "(?i)<a.+?href=\"(http.+?)\".*?>(.+?)</a>".r | |
| object PageLoader { | |
| def load(url: String) = { | |
| try { | |
| Source.fromURL(url).mkString |
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 summer = { | |
| i: { | |
| interned: function(callback) { | |
| IN | |
| .API | |
| .Raw("/companies/1337:(id,name,website-url,location,twitter-id,ticker)") | |
| .method("get") | |
| .result(callback); | |
| } | |
| } |