Skip to content

Instantly share code, notes, and snippets.

View pumpkincouture's full-sized avatar

Sylwia Bridges pumpkincouture

View GitHub Profile
class Field
attr_reader :name,
:label,
:validation_strategy,
:valid_values,
:value,
:error
def initialize(name, label, validation_strategy, valid_values = [])
@name = name
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();
Model
View Controller
User
User uses controller, which manipulates model.
Model then updates view, which the user sees.
# 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
30 11 * * * /your/directory/whatever.pl
class Patrons
def ==(other)
self.attributes == other.attributes
end
def active?
account_status != :inactive
end
attribute :account_status, Symbol
class PatronsRepository
def initialize(db)
@db = db
end
def create!(attrs={})
build_model db.patrons.create!(attrs)
end
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);
public class FileManager {
private File filePath;
private DataOutputStream out;
public FileManager(File filePath, DataOutputStream out) {
this.filePath = filePath;
this.out = out;
}
public String getFileContents() {
# 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;