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
\documentclass {beamer} | |
\usepackage{graphics} | |
\usepackage{listings} | |
\usetheme{Berkeley} | |
\title {Plugin frameworks} | |
\subtitle {3 approaches to designing plugin APIs} |
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
diff --git a/lib/spreadsheet/workbook.rb b/lib/spreadsheet/workbook.rb | |
index 06e17af..eef4f19 100644 | |
--- a/lib/spreadsheet/workbook.rb | |
+++ b/lib/spreadsheet/workbook.rb | |
@@ -56,6 +56,12 @@ module Spreadsheet | |
add_worksheet Worksheet.new(opts) | |
end | |
## | |
+ # Returns the count of total worksheets present. | |
+ # Takes no arguments. Just returns the length of @worksheets array. |
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 Contact { | |
protected String name; | |
protected String number; | |
protected String id; | |
protected Contact(String name, String number) { | |
this.name = name; | |
this.number = number; | |
} |
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
public class ContactActivity extends ListActivity { | |
private EditText filterText; | |
private ArrayAdapter<Contact> adapter; | |
@Override | |
public void onCreate(Bundle icicle) { | |
super.onCreate(icicle); | |
// Use our custom layout | |
setContentView(R.layout.contact); | |
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
.present? is opposite of .blank? = Don't use ugly !blank? | |
xx | |
Missing attribute error occurs when you don't select a certain attr in SQL query but | |
try to use it in ActiveRecord. | |
xx | |
User Time.now.to_s(:db) while comparing datetime in mysql. |
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 AAA < ActiveRecord::Base | |
belongs_to :parent, :class_name => "AAA", :foreign_key => "parent_id" | |
end | |
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 = AAA.new() | |
=> #<AAA id: nil, parent_id: nil> | |
>> a.save! | |
=> true | |
>> b = AAA.new() | |
=> #<AAA id: nil, parent_id: nil> | |
>> b.save! | |
=> true | |
>> b.parent = a | |
=> #<AAA id: 1, parent_id: nil> |
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 assignments | |
object ListUtils { | |
def findLast(list : List[Int]) :Int = { | |
list match { | |
case a :: Nil => a | |
case a :: b => findLast(b) | |
} | |
} |
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 assignments | |
object MiscUtils { | |
def listPrimes(start : Int, end : Int) : List[Int] = { | |
def collect(currentIdx : Int, newList : List[Int]) : List[Int] = { | |
currentIdx match { | |
case a if(a == 2 || a == 3 || (a % 2 != 0 && a % 3 != 0)) => collect(a + 1, newList :+ a) | |
case a if(a >= end) => newList | |
case a => collect(a + 1, newList) |
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 assignments.ListUtils._ | |
import org.scalatest.FlatSpec | |
class ListUtilsTest extends FlatSpec { | |
behavior of "ListUtils" | |
it should "find last of the list" in { | |
assert(findLast(List(1,2,3,4,5)) == 5) | |
assert(findLast(List(1)) == 1) | |
} |
OlderNewer