Skip to content

Instantly share code, notes, and snippets.

# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@michiel
michiel / isactive-component.js
Created June 5, 2014 07:02
bootstrap isActive link/li component
// Bootstrap3
App.ActiveLiComponent = Ember.Component.extend({
tagName : 'li',
classNameBindings : ['isActive:active:inactive'],
router: function() {
return this.container.lookup('router:main');
}.property(),
isActive: function() {
#!/bin/sh
host=localhost:9200
curl -X DELETE "${host}/test"
curl -X PUT "${host}/test" -d '{
"settings" : { "index" : { "number_of_shards" : 1, "number_of_replicas" : 0 }}
}'
import os
import sys
# constants, configure to match your environment
HOST = 'http://localhost:9200'
INDEX = 'test'
TYPE = 'attachment'
TMP_FILE_NAME = 'tmp.json'
@michiel
michiel / nginx-method-filter.conf
Created July 2, 2014 13:32
nginx method filter
map $request_method $not_allowed_method {
default 1;
GET 0;
HEAD 0;
POST 0;
}
if ($not_allowed_method) {
return 405;
}

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:

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"}}
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));
}
var position = $(this).position();
var cssProps = {
top : position.top,
left : position.left,
opacity : '0.55'
};
$(this).click(function() {
$(this).clone().css(cssProps).appendTo(this);
});