In response to a Stack Overflow question, Tree drawing orientation.
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 bcrypt = require('bcrypt'); | |
var HASH_ROUNDS = 10; | |
module.exports = function RedditAPI(conn) { | |
return { | |
createUser: function createUser(user, callback) { | |
// first we have to hash the password... | |
bcrypt.hash(user.password, HASH_ROUNDS, function(err, hashedPassword) { | |
if (err) { |
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 request = require('request'); | |
var prompt = require('prompt'); | |
var Promise = require('bluebird'); | |
var promptPromisified = Promise.promisifyAll(prompt); | |
var requestPromisified = Promise.promisify(request); | |
//necessary function for distanceTo | |
Number.prototype.toRadians = function() { | |
return this * Math.PI / 180; | |
} |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Collapsible Tree Example</title> | |
<style> | |
.node circle { |
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
// Maximum depth is 3, after that we get a "" error from Parse | |
function getUserRoles(user) { | |
var queries = [ | |
new Parse.Query('_Role').equalTo('users', user) | |
]; | |
for (var i = 0; i < 2; i++) { | |
queries.push(new Parse.Query('_Role').matchesQuery('roles', queries[i])); | |
} | |
return user.rolesPromise = Parse.Query.or.apply(Parse.Query, queries).find().then( |
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
// Taken from https://github.com/broofa/jslitmus and prettified | |
function numberToShortLabel(n) { | |
if (n == Infinity) { | |
return 'Infinity'; | |
} | |
else if (n > 1e9) { | |
n = Math.round(n/1e8); | |
return n/10 + 'B'; | |
} | |
else if (n > 1e6) { |
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
Ext.define('MyApp.model.Base', { | |
extend: 'Ext.data.Model', | |
fields: [ | |
{ | |
name: 'objectId', | |
type: 'string' | |
} | |
], |
- Download the perforce visual tool suite from here: http://www.perforce.com/perforce/downloads/index.html
- Copy only the p4merge.app file into your /Applications/ directory
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
@import "compass/css3/shared"; | |
// NOTE: | |
// All mixins for the 2009 spec have been written assuming they'll be fed property values that | |
// correspond to the standard spec. Some mixins can be fed values from the 2009 spec, but don't | |
// rely on it. The `legacy-order` mixin will increment the value fed to it because the 2009 | |
// `box-ordinal-group` property begins indexing at 1, while the modern `order` property begins | |
// indexing at 0. | |
// if `true`, the 2009 properties will be emitted as part of the normal mixin call |
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
Parse.Promise.prototype.toJqueryPromise = function() { | |
var def = jQuery.Deferred(); | |
this.then( | |
def.resolve.bind(def), | |
def.reject.bind(def) | |
); | |
return def.promise(); | |
} |