Skip to content

Instantly share code, notes, and snippets.

@jorgedavila25
jorgedavila25 / elastic_search_connection.rb
Last active March 11, 2020 14:03
Using Ruby's ElasticSearch gem that uses Kaminari for pagination and the Ruby GraphQL gem, this is a custom connection to bypass additional pagination. This assumes that you've already queried the correct paginated records from ElasticSearch and you're returning an `Elasticsearch::Model::Response` object.
class ElasticSearchConnection < GraphQL::Relay::BaseConnection
def has_next_page
!nodes.last_page?
end
def has_previous_page
!nodes.first_page?
end
def cursor_from_node(node)
@jorgedavila25
jorgedavila25 / gist:df178b05b1586c174847
Created April 7, 2015 15:19
EmberCLI solano.yml example
+hooks:
+ pre: npm install && npm install bower && npm install phantomjs && bower install
+nodejs:
+ version: '0.10.32'
+tests:
+ - ember test
// Brocfile.js
...
bootstrapCSS = pickFiles(vendor, {
srcDir: '/bootstrap/dist/css',
files: ['bootstrap.css'],
destDir: '/assets/'
});
...
var outputTrees = [
applicationJs,
(($) ->
$.fn.logoPopup = () ->
this.mousedown ->
$(document).bind "contextmenu",(event)->
true
if event.which === 3
$('<div id="logo-lightbox-container">').hide().appendTo'body'.load '/u/logo',-> $.easybox "#logo-lightbox-container"
)jQuery