Skip to content

Instantly share code, notes, and snippets.

View salami-art's full-sized avatar

salami-art

View GitHub Profile
{
"workspace": "kolumbus",
"collection": "meteoweb",
"type": "gallery",
"advancedCategoryTerm": {
"categoryTerms": "/meteoweb",
"searchInSecondaryCategory": true,
"searchInChildCategories": true
},
"paging": {
def combine_query(query, piece)
# this function always receives its previous return value
_query = {}.merge(query) # also tried Hash.new(), query.dup, query.clone
_query['query'] ||= {}
_query['query']['bool'] ||= {}
_query['query']['bool']['must'] ||= []
_query['query']['bool']['must'] << piece
_query
end
{
"query": {
// ...
},
"aggs": {
"uniq": {
"nested": {
"path": "nested_object"
},
"aggs": {
class SyncPromise {
constructor( callback ) {
try{
this.returnValue = callback();
}
catch(err) {
throw err;
}
}
function numericValue() {
if (stringValue === "one") {
numericValue = 1;
} else if (stringValue === "two") {
numericValue = 2;
} else if (stringValue === "three") {
numericValue = 3;
}
}
def do_stuff_with_data(&block)
data = 1
yield data
end
do_stuff_with_data do |data|
puts data
end
drawRegularBadge() {
return this.getLayer(this.size.rectWidth, this.size.rectHeight + this.size.bottomSpace).then(ctx => {
this.drawRectangle(ctx, [0, 0], [this.size.rectWidth, this.size.rectHeight], this.style);
// ADD TEXT
this.getLine().then(line => {
if (this.style.midStroke) ctx.drawImage(line.canvas, 0, 0);
this.getSpacedText(this.text).then(drawnText => {
// ADD STROKE LINE
ctx.drawImage(drawnText.canvas, this.cn(this.size.padding), this.cn(this.getTextTop(this.size.rectHeight, this.size.fontSize)));
this.drawTriangle(ctx,
<?php
require_once('../../obj/XmlGeocms.php');
require_once('../../obj/Geo.php');
require_once('../../input/stream/Stream.php');
require_once('config.php');
$requestURI = parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH);
$requestURI = explode("/", $requestURI);
$app = $requestURI[4];
if(empty($app)){ echo "app number is empty!"; die(); }
def render_tabs_wrapper
content_tag :ul, class: 'nav nav-tabs' do
content_tag( :li, 'v-sticky': 'value' ) do; ""; end + yield
end
end
class Rating::Option < ApplicationRecord
belongs_to :rating_type, class_name: 'Rating::Type', :foreign_key => "rating_type_id"
has_many :rating_scores, class_name: 'Rating::Score', :foreign_key => "rating_option_id", dependent: :destroy
end