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
class Field | |
attr_reader :name, | |
:label, | |
:validation_strategy, | |
:valid_values, | |
:value, | |
:error | |
def initialize(name, label, validation_strategy, valid_values = []) | |
@name = name |
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 Books = Backbone.Collection.extend({ | |
url: '/books' | |
}); | |
GET /books/ .... collection.fetch(); | |
POST /books/ .... collection.create(); | |
GET /books/1 ... model.fetch(); | |
PUT /books/1 ... model.save(); | |
DEL /books/1 ... model.destroy(); |
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
Model | |
View Controller | |
User | |
User uses controller, which manipulates model. | |
Model then updates view, which the user sees. |
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
# field values | |
Field Range of values | |
minute 0-59 | |
hour 0-23 | |
day 1-31 | |
month 1-12 | |
day-of-week 0-7 (where both 0 and 7 mean Sun, 1 = Mon, 2 = Tue, etc) | |
command-line-to-execute the command to run along with the parameters to that command if any |
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
30 11 * * * /your/directory/whatever.pl |
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
class Patrons | |
def ==(other) | |
self.attributes == other.attributes | |
end | |
def active? | |
account_status != :inactive | |
end | |
attribute :account_status, Symbol |
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
class PatronsRepository | |
def initialize(db) | |
@db = db | |
end | |
def create!(attrs={}) | |
build_model db.patrons.create!(attrs) | |
end | |
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
public class DataManager { | |
private String requestDataString = ""; | |
private String patchDataString = ""; | |
public void updateRequestData(Map<String, String> updatedData, String typeOfEqualitySign) { | |
turnDataIntoString(updatedData, typeOfEqualitySign); | |
} | |
public void updateRequestData(Map<String, String> patchedData) { | |
turnDataIntoString(patchedData); |
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
public class FileManager { | |
private File filePath; | |
private DataOutputStream out; | |
public FileManager(File filePath, DataOutputStream out) { | |
this.filePath = filePath; | |
this.out = out; | |
} | |
public String getFileContents() { |
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
# Connection Manager with DataOutPutStream injected | |
public class ConnectionManager { | |
private DataOutputStream out; | |
private BufferedReader in; | |
private Socket socket; | |
private String directory; | |
private DataManager dataManager; | |
private Logger logger; |