This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Parser | |
def self.run | |
dataset = DB[Sequel[payload[:TenantID].to_sym][payload[:Entity].to_sym]] | |
dataset = dataset.order(Sequel.send(payload[:sortDirection].to_sym, payload[:sortBy].to_sym) ) if payload[:sortBy].present? | |
dataset = dataset.limit(payload[:PageSize]) if payload[:PageSize].present? | |
offset = payload[:PageSize] * (payload[:Page] - 1) | |
offset = 0 if offset < 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"query”: { | |
“Account”: { | |
"arguments": { | |
"first": 5, | |
"after": "<x0>", // cursor next | |
"where": { | |
{ | |
"AccountId": { | |
"inq": { // perform join AccountId where account id match following |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
from graphql import ( | |
graphql, GraphQLSchema, GraphQLObjectType, GraphQLField, GraphQLString, GraphQLList, GraphQLInt, | |
GraphQLArgument, GraphQLInputObjectType, GraphQLInputField, GraphQLNonNull | |
) | |
# Mock data for Accounts and Contacts | |
mock_data = { | |
"Account": [ | |
{"Id": 1, "Name": "Edge Communications", "Industry": "Telecommunications"}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func Cache(key string, expirationTime int, f func() (interface{}, error)) (interface{}, error) { | |
logger.Info("Check caching if exist return the result immediately") | |
q, e := f() | |
logger.Info("Set result to cache") | |
return q, e | |
} | |
func (r *repository) ResolveQuestionSetBySerials(serials []string) (*[]RubelQuestionSet, error) { | |
questionSets, err := Cache("Test", 100, func() (interface{}, error) { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"success": true, | |
"data": [ | |
{ | |
"type": "query", | |
"text": "dress", | |
"score": 123 | |
}, | |
{ | |
"type": "product", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import itertools | |
t = 31 | |
cl = [10,9,8,4] | |
operations = ["+", "-", "*", "/"] | |
def r(a,b,o): | |
a = float(a) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(this.refs.form.getDOMNode()).ajaxForm( { | |
xhrFields: { | |
withCredentials: true | |
}, | |
error: function(response, status) { | |
console.log(response.responseText); | |
console.log(status) | |
}, | |
success: function(response, status) { | |
console.log(response); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.text.DateFormat; | |
import java.text.SimpleDateFormat; | |
import java.text.ParseException; | |
import java.util.Date; | |
import java.util.TimeZone; | |
public class ParseTimeWithTimezone{ | |
public static void main(String []args){ | |
try { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"AWSTemplateFormatVersion" : "2010-09-09", | |
"Description" : "AWS CloudFormation Template multi-tier-web-app-in-vpc. It will create a multi-tier web applications in a VPC with multiple subnets. The first subnet is public and contains and internet facing load balancer, a NAT device for internet access from the private subnet and a bastion host to allow SSH access to the hosts in the private subnet. The second subnet is private and contains a Frontend fleet Security Group for EC2 instances", | |
"Parameters" : { | |
"KeyName": { | |
"Description" : "Name of an existing EC2 KeyPair to enable SSH access to the instances", | |
"Type": "String", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import unittest | |
import os | |
import time | |
class Clock: | |
WORK_DAYS = 22 | |
AVERAGE_SALARY = 4000.0 | |
WORK_HOURS = 8 |