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 UserMapper = require('./userMapper'); | |
var user = UserMapper.create();//optionally provide attributes | |
user.name = 'Lee Mason'; | |
UserMapper.save(user); |
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 User = require('./user'); | |
var user = new User(); | |
user.name = 'Lee Mason'; | |
user.save(); |
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
let factory = require('factory'), | |
db = require('db_module'), | |
config = require('config'); | |
factory.register('db', function(){ | |
return new db(config.db); | |
}); | |
//carry on, db is registered |
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
let DB = require('db_facade'); | |
// Now you can use DB as its already created, this means we dont need to create it everywhere we use it. | |
export default class Controller{ | |
postIndex(req, res){ | |
DB.insert('table', req.get('data')); | |
} | |
} |
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
let db = require('db_module'), | |
config = require('config'); | |
let DB = new db(config.db); | |
// Now you can use DB | |
export default class Controller{ | |
postIndex(req, res){ | |
DB.insert('table', req.get('data')); |
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 logger = require('./services/logger'), | |
db = require('./services/db'); | |
db.select('select * from users', function(items){ | |
//do something | |
logger.info(`${items.length} returned.`); | |
}); |
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
<?php | |
Interface Config{ | |
public function get($key); | |
public function set($key, $value); | |
} |
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 mason = new Mason(); | |
sql = mason | |
.select('*') | |
.from('users') | |
.where(function(builder){ | |
builder | |
.where('first_name', 'lee') | |
.where('last_name', 'mason'); | |
}) |
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
#!/bin/bash | |
#send sync request to s3 bucket | |
/usr/bin/trickle -s -u 4000 -d 4000 /usr/bin/s3cmd --config=/home/{{user}}/.s3cfg sync /backups s3://{{bucketname}}/{{location}}/ |
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
[default] | |
access_key = {{access_key}} | |
secret_key = {{secret_key}} | |
bucket_location = US | |
cloudfront_host = cloudfront.amazonaws.com | |
cloudfront_resource = /2010-07-15/distribution | |
default_mime_type = binary/octet-stream | |
delete_removed = False | |
dry_run = False | |
encoding = UTF-8 |