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
val fib = (n:Int) => (0 until n).foldLeft(0, 1) { (x, i) => (x._2, x._1 + x._2) }._1 |
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
/* | |
* Copyright (c) Ian F. Darwin 1986-1995. | |
* Software written by Ian F. Darwin and others; | |
* maintained 1995-present by Christos Zoulas and others. | |
* | |
* Redistribution and use in source and binary forms, with or without | |
* modification, are permitted provided that the following conditions | |
* are met: | |
* 1. Redistributions of source code must retain the above copyright | |
* notice immediately at the beginning of the file, without modification, |
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
1. (s: String) => Pattern.compile(regex, flags).matcher(text) | |
2. region(pos, str.length).lookingAt |
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
function numberLines(node, isPreformatted) { | |
var nocode = /(?:^|\s)nocode(?:\s|$)/; | |
var lineBreak = /\r\n?|\n/; | |
var document = node.ownerDocument; | |
var li = document.createElement('li'); | |
while (node.firstChild) { | |
li.appendChild(node.firstChild); | |
} |
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
// Create a jquery plugin that prints the given element. | |
jQuery.fn.print = function(){ | |
// NOTE: We are trimming the jQuery collection down to the | |
// first element in the collection. | |
if (this.size() > 1){ | |
this.eq( 0 ).print(); | |
return; | |
} else if (!this.size()){ | |
return; | |
} |
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
/** Akshaal, 2012. http://akshaal.info */ | |
import language.experimental.macros | |
import scala.reflect.macros.Context | |
import scala.annotation.Annotation | |
/** | |
* Macros for traversing over annotated elements. | |
* | |
* See http://www.akshaal.info/2012/08/scala-210-annotated-fields-macro.html for more information. |
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
package book | |
object diff { | |
trait Expression | |
case class Const[A: Numeric](value: A) extends Expression { | |
override def toString = value.toString | |
} | |
case class Var(name: String) extends Expression { |
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
# ls | |
alias ls="ls -G" | |
alias la="ls -a" | |
alias ll="ls -l" | |
alias rm="rm -iv" | |
alias mv="mv -iv" | |
alias cp="cp -iv" | |
alias cr="cp -R" |
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
export PATH=/usr/local/bin:$PATH:/usr/local/share/npm/bin | |
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function* | |
bind "set completion-ignore-case on" | |
#export PS1="\[\e[1;32m\]\u\[\e[m\]\[\e[0;36m\]@\[\e[m\]\[\e[1;31m\]\h\[\e[m\]\[\e[0;36m\]:\[\e[m\]\[\e[1;33m\]\w\[\e[m\]\n\[\e[1;37m\] \$ \[\e[m\]" | |
if [ -f ~/.bash_aliases ]; then |
OlderNewer