Skip to content

Instantly share code, notes, and snippets.

sudo apt-get update
# Install java
sudo apt-get install openjdk-7-jre-headless wget curl -y
# Install elasticsearch
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.0.3.deb
sudo dpkg -i elasticsearch-1.0.3.deb
sudo service elasticsearch start
@teamon
teamon / Gemfile
Created April 17, 2014 08:39
Mount Grape API at rails root
source "http://rubygems.org"
gem "railties", '4.0.3', require: %w(action_controller rails)
gem "grape"
irb(main):010:0> class A; def dupa(x); x; end; end
=> nil
irb(main):012:0> module Over; def dupa(x); x + 1; end; end
=> nil
irb(main):013:0> A.new.dupa(1)
=> 1
irb(main):014:0> A.new.extend(Over).dupa(1)
=> 2
.redesign .title {
margin-top: 0;
margin-left: 0;
}
.redesign .segment {
margin-bottom: 0;
}
.redesign .segment-content,
/**
* State-based routing for AngularJS
* @version v0.2.8
* @link http://angular-ui.github.com/
* @license MIT License, http://www.opensource.org/licenses/MIT
*/
"undefined"!=typeof module&&"undefined"!=typeof exports&&module.exports===exports&&(module.exports="ui.router"),function(a,b,c){"use strict";function d(a,b){return H(new(H(function(){},{prototype:a})),b)}function e(a){return G(arguments,function(b){b!==a&&G(b,function(b,c){a.hasOwnProperty(c)||(a[c]=b)})}),a}function f(a,b){var c=[];for(var d in a.path){if(a.path[d]!==b.path[d])break;c.push(a.path[d])}return c}function g(a,b){if(Array.prototype.indexOf)return a.indexOf(b,Number(arguments[2])||0);var c=a.length>>>0,d=Number(arguments[2])||0;for(d=0>d?Math.ceil(d):Math.floor(d),0>d&&(d+=c);c>d;d++)if(d in a&&a[d]===b)return d;return-1}function h(a,b,c,d){var e,h=f(c,d),i={},j=[];for(var k in h)if(h[k].params&&h[k].params.length){e=h[k].params;for(var l in e)g(j,e[l])>=0||(j.push(e[l]),i[e[l]]=a[e[l]])}return H({},i,b)}function i(a,b){var c={};retu
@teamon
teamon / app.slim
Created December 19, 2013 16:18
Watch state params changes
body body-locker="true"
@teamon
teamon / gist:7678184
Last active December 29, 2015 13:39 — forked from bitrut/gist:7676303
db = {
person: {
save: function(obj){
if(obj.id){
return $http.post("/person", obj).then(function(res){
var data = angular.extend({}, obj); // create copy of `obj` + `id` field
data.id = res.data.id;
return data;
})
} else {
@teamon
teamon / Nav.scala
Created September 10, 2013 15:47 — forked from fayimora/Nav.scala
val api = new Namespace("api"){
val v1 = new Namespace("v1"){
GET on "/" to Application.index _
val todos = resources("todos", Todos)
val posts = resources("posts", Posts)
val comments = resources("comments", Comments)
}
val v1_1 = new Namespace("v1.1"){
GET on "/" to Application.index _
[1] pry(main)> ActionController::Parameters.new(:a => 1, :b => [1,2,3], :c => nil).permit(:a, :b => [], :c => [])
=> {"a"=>1, "b"=>[1, 2, 3]}
[2] pry(main)> ActionController::Parameters.new(:a => 1, :b => [1,2,3], :c => nil).permit(:a, :c => [], :b => [])
=> {"a"=>1}
[3] pry(main)> ActionController::Parameters.new(:a => 1, :b => [1,2,3], :c => []).permit(:a, :b => [], :c => [])
=> {"a"=>1, "b"=>[1, 2, 3], "c"=>[]}
[4] pry(main)> ActionController::Parameters.new(:a => 1, :b => [1,2,3], :c => []).permit(:a, :c => [], :b => [])
t.references :contract, index: true # works
t.string :actor_uid, index: true # nope
t.index :actor_uid # proper way to add index for non-references field