Note: This was written using elasticsearch 0.9.
Elasticsearch will automatically create an index (with basic settings and mappings) for you if you post a first document:
$ curl -X POST 'http://localhost:9200/thegame/weapons/1' -d \
'{
"_id": 1,| # | |
| # Wide-open CORS config for nginx | |
| # | |
| location / { | |
| if ($request_method = 'OPTIONS') { | |
| add_header 'Access-Control-Allow-Origin' '*'; | |
| # |
| <?php | |
| set_include_path(get_include_path() . PATH_SEPARATOR . realpath(dirname(__FILE__) . '/Elastica/lib')); | |
| function elasticsearch_autoload($class) { | |
| $file = str_replace('_', '/', $class) . '.php'; | |
| require_once $file; | |
| } | |
| spl_autoload_register('elasticsearch_autoload'); | |
| defined('BASE_PATH') || define('BASE_PATH', realpath(dirname(__FILE__))); |
| -Dsun.java2d.xrender=true | |
| -Dswing.aatext=true | |
| -Dawt.useSystemAAFontSettings=lcd |
| #!/bin/sh | |
| echo | |
| curl -XDELETE 'http://localhost:9200/products' | |
| echo | |
| curl -XPUT 'localhost:9200/products' -d ' | |
| { | |
| "mappings" : { | |
| "Root" : { |
| app.directive('ngFocus', ['$parse', function($parse) { | |
| return function(scope, element, attr) { | |
| var fn = $parse(attr['ngFocus']); | |
| element.bind('focus', function(event) { | |
| scope.$apply(function() { | |
| fn(scope, {$event:event}); | |
| }); | |
| }); | |
| } | |
| }]); |
| # Solves: | |
| # error: Couldn't set refs/heads/branchName | |
| # To X:xxx.git | |
| # ! [remote rejected] branchName -> branchName (failed to write) | |
| # error: failed to push some refs to 'X:xxx.git' | |
| git fsck --unreachable | |
| git reflog expire --expire=0 --all | |
| git repack -a -d -l | |
| git prune |
| // Detecting data URLs | |
| // data URI - MDN https://developer.mozilla.org/en-US/docs/data_URIs | |
| // The "data" URL scheme: http://tools.ietf.org/html/rfc2397 | |
| // Valid URL Characters: http://tools.ietf.org/html/rfc2396#section2 | |
| function isDataURL(s) { | |
| return !!s.match(isDataURL.regex); | |
| } | |
| isDataURL.regex = /^\s*data:([a-z]+\/[a-z]+(;[a-z\-]+\=[a-z\-]+)?)?(;base64)?,[a-z0-9\!\$\&\'\,\(\)\*\+\,\;\=\-\.\_\~\:\@\/\?\%\s]*\s*$/i; |
Note: This was written using elasticsearch 0.9.
Elasticsearch will automatically create an index (with basic settings and mappings) for you if you post a first document:
$ curl -X POST 'http://localhost:9200/thegame/weapons/1' -d \
'{
"_id": 1,| sudo apt-get update | |
| sudo apt-get upgrade | |
| sudo apt-get install gcc autoconf bison flex libtool make libboost-all-dev libcurl4-openssl-dev curl libevent-dev uuid-dev | |
| cd ~ | |
| wget https://launchpad.net/gearmand/1.2/1.1.12/+download/gearmand-1.1.12.tar.gz |
| # Create your superuser | |
| $ mongo | |
| > use admin | |
| > db.createUser({user:"someadmin",pwd:"secret", roles:[{role:"root",db:"admin"}]}) | |
| > exit | |
| # Alias for convenience (optional and at your own risk) | |
| $ echo 'alias mongo="mongo --port 27017 -u someadmin -p secret --authenticationDatabase admin"' >> ~/.bash_profile | |
| $ source ~/.bash_profile |