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
models.Page.find({ parent_id: null }).sort({ name: 'asc' }).exec (err, pages) -> | |
for page, i in pages | |
models.Page.find({ parent_id: page._id }).sort({ name: 'asc' }).exec (err, children) -> | |
pages[i].children = children | |
# return pages when all the queries are done |
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
function get_user($where, $ignore = array('email', 'password', 'ip_address', 'fb_id')) { | |
if($where) $this->db->where($where); | |
$this->db->limit(1); | |
$query = $this->db->get('users'); | |
if($query->num_rows() > 0) { | |
$user = $query->row(); | |
// Unset some private data that should not leave our database | |
if(is_array($ignore) && count($ignore)) { | |
foreach($ignore as $i) { |
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 person = function() { | |
var name = null, | |
age = null, | |
hair = null; | |
return { | |
birth: function() { | |
name = 'Chris'; | |
age = 27; | |
hair = 'blonde'; |
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 myClojure = function() { | |
// What types of variables should I keep here? | |
// Beyond them being private, what's the advantage? | |
// Sometimes I lose track of the names and clobber these with variables in the object | |
var privateValue = 'this is a secret'; | |
return { | |
// And, which should I place here? | |
publicValue: 'Everyone knows this', | |
NewerOlder