This file contains 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
!! drop in Solarized colorscheme for Xresources/Xdefaults | |
!!SOLARIZED HEX 16/8 TERMCOL XTERM/HEX L*A*B RGB HSB | |
!!--------- ------- ---- ------- ----------- ---------- ----------- ----------- | |
!!base03 #002b36 8/4 brblack 234 #1c1c1c 15 -12 -12 0 43 54 193 100 21 | |
!!base02 #073642 0/4 black 235 #262626 20 -12 -12 7 54 66 192 90 26 | |
!!base01 #586e75 10/7 brgreen 240 #585858 45 -07 -07 88 110 117 194 25 46 | |
!!base00 #657b83 11/7 bryellow 241 #626262 50 -07 -07 101 123 131 195 23 51 | |
!!base0 #839496 12/6 brblue 244 #808080 60 -06 -03 131 148 150 186 13 59 | |
!!base1 #93a1a1 14/4 brcyan 245 #8a8a8a 65 -05 -02 147 161 161 180 9 63 |
This file contains 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
<!-- Solarized colors configuration for console2 --> | |
<!-- http://ethanschoonover.com/solarized --> | |
<!-- http://sourceforge.net/projects/console/ --> | |
<!-- Replace this colors in console.xml configuration file --> | |
<colors> | |
<color id="0" r="7" g="54" b="66"/> | |
<color id="1" r="38" g="139" b="210"/> | |
<color id="2" r="133" g="153" b="0"/> | |
<color id="3" r="42" g="161" b="152"/> | |
<color id="4" r="220" g="50" b="47"/> |
This file contains 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
;Implement a function called (big st n) that returns true if a string st | |
;is longer than n characters. | |
(defn big [st n] (> (count st) n)) | |
;Write a function called (collection-type col) that returns :list, :map, | |
;or :vector based on the type of collection col. | |
(defmulti collection-type class) | |
(defmethod collection-type clojure.lang.IPersistentList [arg] :list) | |
(defmethod collection-type clojure.lang.IPersistentMap [arg] :map) | |
(defmethod collection-type clojure.lang.IPersistentVector [arg] :vector) |
This file contains 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
% Monitor the translate_service and restart it should it die. | |
-module(doctor_translate). | |
-export([loop/0]). | |
loop() -> | |
process_flag(trap_exit, true), | |
receive | |
new -> | |
io:format("Creating and monitoring process.~n"), | |
register(translator, spawn_link(fun translate_service:loop/0)), |
This file contains 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
% Consider a shopping list that looks like [{item quantity price}, ...]. | |
% Write a list comprehension that builds a list of items of the form | |
% [{item total_price}, ...], where total_price is quantity times price. | |
-module(comprehesion). | |
ShoppingList = [{apple, 4, 0.2}, {orange, 3, 1.1}, {peach, 4, 1}]. | |
Total = [{Product, Quantity * Price} || {Product, Quantity, Price} <- ShoppingList]. |
This file contains 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(day1). | |
-export([number_of_words/1]). | |
-export([count/1]). | |
-export([print_message/1]). | |
% Write a function that uses recursion to return the number of | |
% words in a string. | |
list_size([]) -> 0; | |
list_size([H|T]) -> 1+list_size(T). |
This file contains 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 the sizer program, what would happen if you did not create a | |
// new actor for each link you wanted to follow? | |
// An actor must sent more than one message | |
// What would happen | |
// to the performance of the application? | |
// The performace will be worst |
This file contains 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
// A discussion on how to use Scala files | |
// http://stackoverflow.com/questions/1284423/read-entire-file-in-scala | |
// http://www.naildrivin5.com/blog/2010/01/26/reading-a-file-in-scala-ruby-java.html | |
// What makes a closure different from a code block | |
// http://gleichmann.wordpress.com/2010/11/15/functional-scala-closures/ | |
// Closures have free variables, which are not bounded |
This file contains 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 org.specs.runner.JUnit4 | |
import org.specs.runner._ | |
import org.specs._ | |
import org.junit.runner.RunWith | |
import org.specs.runner.JUnitSuiteRunner | |
import scala.collection.mutable.HashSet | |
@RunWith(classOf[JUnitSuiteRunner]) | |
class BoardSpecTest extends Specification with JUnit { | |
This file contains 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
% Some implementations of a Fibonacci series and factorials. How | |
% do they work? | |
% La sintaxis es factorial(N, F) -> Factorial de N es F (el resultado se guarda en F) | |
factorial(0, 1). | |
factorial(N, F) :- N>0, N1 is N - 1, factorial(N1, F1), F is N*F1. | |
%el factorial se llama recursivamente dejando el resultado en F |