test.1
This file contains 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
// Get the connection uri and set it up for processing | |
var uri = process.env.MONGOLAB_URI; | |
var uri = uri.slice(uri.indexOf('/')+1); | |
var user = uri.substring(1, uri.indexOf(':')); | |
var pass = uri.substring(uri.indexOf(':')+1, uri.indexOf("@")); | |
var dbName = uri.substring(uri.lastIndexOf("/")+1); | |
var port = uri.substring(uri.lastIndexOf(":") + 1, uri.lastIndexOf("/")); | |
var host = uri.substring(uri.lastIndexOf("@") + 1, uri.lastIndexOf(":")); |
This file contains 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
for (NSString *familyName in [UIFont familyNames]) { | |
for (NSString *fontName in [UIFont fontNamesForFamilyName:familyName]) { | |
NSLog(@"%@ - %@", familyName, fontName); | |
} | |
} |
This file contains 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
NSMutableAttributedString *string = [[NSMutableAttributedString alloc] initWithString:@"camera"]; | |
[string setAttributes:@{(NSString *)kCTLigatureAttributeName:[NSNumber numberWithInt:2]} range:NSMakeRange(0, string.length)]; | |
self.myUILabel.attributedText = string; |
This file contains 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 svg = d3.select('#example-1') | |
.append('svg') | |
.attr('width', 202) | |
.attr('height', 202); | |
var data = d3.range(10).map(function (d, i) { | |
return i; | |
}); |
This file contains 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 svg = d3.select('#example-3') | |
.append('svg') | |
.attr('width', '100%') | |
.attr('viewBox', '0 0 202 202'); | |
var data = d3.range(10).map(function (d, i) { | |
return i; | |
}); |
This file contains 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 aspectRatio= '16:9'; | |
var viewBox = '0 0 ' + aspectRatio.split(':').join(' '); | |
var svg = d3.select('#example-4') | |
.append('svg') | |
.attr('width', '100%') | |
.attr('viewBox', viewBox); | |
// draw the background |
This file contains 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
// This can be generalized to arbitrary | |
// aspect ratios. See last example for | |
// more on that. | |
// See calculation for total size in | |
// example above | |
var size = 202; | |
// 1st example - set an explicit |
This file contains 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
// Assume a variable called `svg` | |
// has already been created, | |
// corresponding to a d3 selection | |
// of an SVG element. | |
// | |
// For this example take the | |
// 'size' of the svg to be 202x202 pixels | |
var marginSize = 1; |
This file contains 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 _ = require('lodash'); | |
var d3 = require('d3'); | |
function randomVariable(rate) { | |
rate = rate || 1; | |
var U = Math.random(); | |
return -Math.log(U)/rate; | |
}; | |
var start = 0; |