Skip to content

Instantly share code, notes, and snippets.

@michiel
michiel / valueFromPath.js
Created December 9, 2014 19:59
Value from json path
function valueFromObjectPath(obj, path) {
var steps = path.split(/\//);
var val = obj;
while (steps.length) {
var key = steps.shift();
if (typeof(val[key]) !== 'undefined') {
val = val[ key ];
} else {
require('config/adapters/faye-adapter');
export default DS.FayeAdapter.extend();
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="http://d3js.org/d3.v2.js"></script>
<link href="styles.css" rel="stylesheet" type="text/css" />
<title>"Percent complete" bar</title>
</head>
desc "Generate a new key"
task :gen_key do
domain = get_env(:domain)
filename = "#{domain}.key"
`openssl genrsa -out #{filename} 2048`
end
desc "Generate a new CSR"
task :gen_csr => :gen_key do
#
# A CORS (Cross-Origin Resouce Sharing) config for nginx
#
# == Purpose
#
# This nginx configuration enables CORS requests in the following way:
# - enables CORS just for origins on a whitelist specified by a regular expression
# - CORS preflight request (OPTIONS) are responded immediately
# - Access-Control-Allow-Credentials=true for GET and POST requests
var position = $(this).position();
var cssProps = {
top : position.top,
left : position.left,
opacity : '0.55'
};
$(this).click(function() {
$(this).clone().css(cssProps).appendTo(this);
});
function logslider(pos) {
var minp = 0;
var maxp = 100;
var minv = Math.log(100);
var maxv = Math.log(10000000);
var scale = (maxv - minv) / (maxp - minp);
return Math.exp(minv + scale * (pos - minp));
}

Ace editor component for Ember.

  • A two-way binding is set up between value and the text in the editor.
  • Configure Ace in the aceInit callback.

Template

{{ace-editor value=value aceInit=aceInit class="editor"}}

Keybase proof

I hereby claim:

  • I am michiel on github.
  • I am michielkalkman (https://keybase.io/michielkalkman) on keybase.
  • I have a public key whose fingerprint is 7A12 8594 3745 859D B6F6 B417 E8F4 53D6 FDC5 CCFA

To claim this, I am signing this object: