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
language = "elixir" | |
^language = "ruby" # raise MatchError |
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
defmodule Foo do | |
def cc(?0), do: 0 | |
def cc(?1), do: 1 | |
def cc(?2), do: 2 | |
def cc(?3), do: 3 | |
def cc(?4), do: 4 | |
def cc(?5), do: 5 | |
def cc(?6), do: 6 | |
def cc(?7), do: 7 | |
def cc(?8), do: 8 |
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
cd() { | |
builtin cd "$1" | |
if [ -d "venv" ] then | |
. venv/bin/activate | |
fi | |
} |
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
mysql> show status; | |
+------------------------------------------+---------------+ | |
| Variable_name | Value | | |
+------------------------------------------+---------------+ | |
| Aborted_clients | 3499360 | | |
| Aborted_connects | 3005 | | |
| Binlog_cache_disk_use | 52 | | |
| Binlog_cache_use | 15845471 | | |
| Binlog_stmt_cache_disk_use | 0 | | |
| Binlog_stmt_cache_use | 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
// | |
// MyPageView.m | |
// AppotaApp | |
// | |
// Created by Anh Toan on 11/27/12. | |
// Copyright (c) 2012 __MyCompanyName__. All rights reserved. | |
// | |
#import "MyPageView.h" | |
#import "UserCommentView.h" |
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 patmat | |
import common._ | |
/** | |
* Assignment 4: Huffman coding | |
* | |
*/ | |
object Huffman { |
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 objsets | |
// real tweet data, collected on Oct 1 | |
object TweetData { | |
val gizmodo = """[ | |
{ "user": "gizmodo", "text": "Kindle Paperwhite Review: Forget Everything Else, This Is the E-Reader You Want http://t.co/737W6aNC", "retweets": 51.0 }, | |
{ "user": "gizmodo", "text": "These new Apple patents give a sneak peek at what future iPhone cameras might have in store. http://t.co/0YT9rjxp", "retweets": 49.0 }, | |
{ "user": "gizmodo", "text": "Ever wonder why the sky is dark at night? Here's your answer. http://t.co/eTKxkcaE", "retweets": 86.0 }, | |
{ "user": "gizmodo", "text": "The head of Homeland Security stays secure by just not using email, at all. http://t.co/W6KAFEUu", "retweets": 37.0 }, | |
{ "user": "gizmodo", "text": "This is how graphene will grow the flexible semiconductors of the future: http://t.co/IoEvuxp4", "retweets": 43.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
class FiboUsingDictionary | |
include Singleton | |
def initialize | |
@fib = { 0 => 1, 1 => 1 } | |
end | |
def [](n) | |
return @fib[n] if @fib.include? n | |
@fib[n] = self[n -1] + self[n - 2] |
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
class FiboUsingArray | |
include Singleton | |
def initialize | |
@fib = [1, 1] | |
end | |
def [](n) | |
if n < @fib.size then | |
@fib[n] |
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
require 'benchmark' | |
Benchmark.bm do |x| | |
names = ["matz", "rossum", "ryal", "ritchie", "brendan"] | |
n = 50000 | |
x.report "method missing" do | |
class Array | |
def method_missing name, *argv | |
super unless name =~ /^sort_by_(\w+)_(asc|desc)$/ |